"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.
This commit is contained in:
parent
be36352572
commit
6ad9774189
115 changed files with 70 additions and 62 deletions
16
exercises/010_if2.zig
Normal file
16
exercises/010_if2.zig
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// 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});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue