You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
404 B
Zig
17 lines
404 B
Zig
//
|
|
// If statements are also valid expressions:
|
|
//
|
|
// const foo: u8 = if (a) 2 else 3;
|
|
//
|
|
const std = @import("std");
|
|
|
|
pub fn main() void {
|
|
const discount = true;
|
|
|
|
// Please use an if...else expression to set "price".
|
|
// If discount is true, the price should be $17, otherwise $20:
|
|
const price: u8 = if ???;
|
|
|
|
std.debug.print("With the discount, the price is ${}.\n", .{price});
|
|
}
|