221V 4 дней назад
Родитель
Сommit
3a856b8f38
1 измененных файлов с 27 добавлено и 25 удалено
  1. 27 25
      exercises/030_switch.zig

+ 27 - 25
exercises/030_switch.zig

@@ -24,30 +24,32 @@
 //
 //
 const std = @import("std");
 const std = @import("std");
 
 
-pub fn main() void {
-    const lang_chars = [_]u8{ 26, 9, 7, 42 };
-
-    for (lang_chars) |c| {
-        switch (c) {
-            1 => std.debug.print("A", .{}),
-            2 => std.debug.print("B", .{}),
-            3 => std.debug.print("C", .{}),
-            4 => std.debug.print("D", .{}),
-            5 => std.debug.print("E", .{}),
-            6 => std.debug.print("F", .{}),
-            7 => std.debug.print("G", .{}),
-            8 => std.debug.print("H", .{}),
-            9 => std.debug.print("I", .{}),
-            10 => std.debug.print("J", .{}),
-            // ... we don't need everything in between ...
-            25 => std.debug.print("Y", .{}),
-            26 => std.debug.print("Z", .{}),
-            // Switch statements must be "exhaustive" (there must be a
-            // match for every possible value).  Please add an "else"
-            // to this switch to print a question mark "?" when c is
-            // not one of the existing matches.
-        }
+pub fn main() void{
+  const lang_chars = [_]u8{ 26, 9, 7, 42 };
+  
+  for(lang_chars) |c|{
+    switch(c){
+      1 => std.debug.print("A", .{}),
+      2 => std.debug.print("B", .{}),
+      3 => std.debug.print("C", .{}),
+      4 => std.debug.print("D", .{}),
+      5 => std.debug.print("E", .{}),
+      6 => std.debug.print("F", .{}),
+      7 => std.debug.print("G", .{}),
+      8 => std.debug.print("H", .{}),
+      9 => std.debug.print("I", .{}),
+      10 => std.debug.print("J", .{}),
+      // ... we don't need everything in between ...
+      25 => std.debug.print("Y", .{}),
+      26 => std.debug.print("Z", .{}),
+      // Switch statements must be "exhaustive" (there must be a
+      // match for every possible value).  Please add an "else"
+      // to this switch to print a question mark "?" when c is
+      // not one of the existing matches.
+      else => { std.debug.print("?", .{}); }
     }
     }
-
-    std.debug.print("\n", .{});
+  }
+  
+  std.debug.print("\n", .{});
 }
 }
+