diff options
| author | lording <mathias.berthonneau@gmail.com> | 2023-06-22 09:41:41 +0000 |
|---|---|---|
| committer | lording <mathias.berthonneau@gmail.com> | 2023-06-22 09:41:41 +0000 |
| commit | d2d3dfa277e7d2a22ebbaf9b47316363035ed500 (patch) | |
| tree | 95b679455dcbb501f0a65d76fe7bc2b73a1ee32a /exercises/010_if2.zig | |
| parent | f09a87c348bafb134e3f5eca0ef654cc2a20ceef (diff) | |
var to const when posssible
Diffstat (limited to 'exercises/010_if2.zig')
| -rw-r--r-- | exercises/010_if2.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/exercises/010_if2.zig b/exercises/010_if2.zig index d0c8cac..f0ffb43 100644 --- a/exercises/010_if2.zig +++ b/exercises/010_if2.zig @@ -1,16 +1,16 @@ // // If statements are also valid expressions: // -// var foo: u8 = if (a) 2 else 3; +// const foo: u8 = if (a) 2 else 3; // const std = @import("std"); pub fn main() void { - var discount = true; + const 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 ???; + const price: u8 = if ???; std.debug.print("With the discount, the price is ${}.\n", .{price}); } |
