mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 22:13:11 -05:00
0956f1839f
When I hit 999 exercises, I will finally have reached the ultimate state of soteriological release and no more exercises will be needed. The cycle will be complete. All that will be left is perfect quietude, freedom, and highest happiness.
32 lines
774 B
Zig
32 lines
774 B
Zig
//
|
|
// Now we get into the fun stuff, starting with the 'if' statement!
|
|
//
|
|
// if (true) {
|
|
// ...
|
|
// } else {
|
|
// ...
|
|
// }
|
|
//
|
|
// Zig has the "usual" comparison operators such as:
|
|
//
|
|
// a == b means "a equals b"
|
|
// a < b means "a is less than b"
|
|
// a != b means "a does not equal b"
|
|
//
|
|
// The important thing about Zig's "if" is that it *only* accepts
|
|
// boolean values. It won't coerce numbers or other types of data
|
|
// to true and false.
|
|
//
|
|
const std = @import("std");
|
|
|
|
pub fn main() void {
|
|
const foo = 1;
|
|
|
|
// Please fix this condition:
|
|
if (foo) {
|
|
// We want our program to print this message!
|
|
std.debug.print("Foo is 1!\n", .{});
|
|
} else {
|
|
std.debug.print("Foo is not 1!\n", .{});
|
|
}
|
|
}
|