221V 1 week ago
parent
commit
129359ec26
1 changed files with 12 additions and 11 deletions
  1. 12 11
      exercises/014_while4.zig

+ 12 - 11
exercises/014_while4.zig

@@ -12,15 +12,16 @@
 //
 //
 const std = @import("std");
 const std = @import("std");
 
 
-pub fn main() void {
-    var n: u32 = 1;
-
-    // Oh dear! This while loop will go forever?!
-    // Please fix this so the print statement below gives the desired output.
-    while (true) : (n += 1) {
-        if (???) ???;
-    }
-
-    // Result: we want n=4
-    std.debug.print("n={}\n", .{n});
+pub fn main() void{
+  var n: u32 = 1;
+  
+  // Oh dear! This while loop will go forever?!
+  // Please fix this so the print statement below gives the desired output.
+  while(true) : (n += 1){
+    if(n == 4){ break; }
+  }
+  
+  // Result: we want n=4
+  std.debug.print("n={}\n", .{n});
 }
 }
+