221V 1 week ago
parent
commit
44673acae9
1 changed files with 15 additions and 14 deletions
  1. 15 14
      exercises/011_while.zig

+ 15 - 14
exercises/011_while.zig

@@ -17,18 +17,19 @@
 //
 const std = @import("std");
 
-pub fn main() void {
-    var n: u32 = 2;
-
-    // Please use a condition that is true UNTIL "n" reaches 1024:
-    while (???) {
-        // Print the current number
-        std.debug.print("{} ", .{n});
-
-        // Set n to n multiplied by 2
-        n *= 2;
-    }
-
-    // Once the above is correct, this will print "n=1024"
-    std.debug.print("n={}\n", .{n});
+pub fn main() void{
+  var n: u32 = 2;
+  
+  // Please use a condition that is true UNTIL "n" reaches 1024:
+  while(n < 1024){
+    // Print the current number
+    std.debug.print("{} ", .{n});
+    
+    // Set n to n multiplied by 2
+    n *= 2;
+  }
+  
+  // Once the above is correct, this will print "n=1024"
+  std.debug.print("n={}\n", .{n});
 }
+