mirror of
https://codeberg.org/ziglings/exercises.git
synced 2024-12-28 10:26:29 +00: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.
16 lines
398 B
Zig
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});
|
|
}
|