31 - plus opinionated convert to const

This commit is contained in:
Adam Millerchip 2021-12-26 13:22:43 +09:00
parent 1d9ada1c08
commit 4579805357
1 changed files with 2 additions and 1 deletions

View File

@ -15,7 +15,7 @@ pub fn main() void {
const lang_chars = [_]u8{ 26, 9, 7, 42 };
for (lang_chars) |c| {
var real_char: u8 = switch (c) {
const real_char: u8 = switch (c) {
1 => 'A',
2 => 'B',
3 => 'C',
@ -31,6 +31,7 @@ pub fn main() void {
26 => 'Z',
// As in the last exercise, please add the 'else' clause
// and this time, have it return an exclamation mark '!'.
else => '!',
};
std.debug.print("{c}", .{real_char});