ziglings/exercises/010_if2.zig
Dave Gauer 0956f1839f "999 is enough for anybody" triple-zero padding (#18)
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.
2021-03-12 18:59:46 -05:00

16 lines
398 B
Zig

//
// If statements are also valid expressions:
//
// var foo: u8 = if (a) 2 else 3;
//
const std = @import("std");
pub fn main() void {
var discount = true;
// Please use an if...else expression to set "price".
// If discount is true, the price should be $17, otherwise $20:
var price: u8 = if ???;
std.debug.print("With the discount, the price is ${}.\n", .{price});
}