Loops/For: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
(switched to for-loops) |
||
Line 4,152: | Line 4,152: | ||
=={{header|Zig}}== |
=={{header|Zig}}== |
||
<syntaxhighlight lang="zig"> |
<syntaxhighlight lang="zig"> |
||
const std = @import("std"); |
|||
pub fn main() !void { |
pub fn main() !void { |
||
const stdout_wr = std.io.getStdOut().writer(); |
const stdout_wr = std.io.getStdOut().writer(); |
||
for (1..6) |n| { |
|||
for (0..n) |_| { |
|||
var j: u8 = 1; |
|||
while (j <= i) : (j += 1) |
|||
try stdout_wr.writeAll("*"); |
try stdout_wr.writeAll("*"); |
||
} |
|||
try stdout_wr.writeAll("\n"); |
try stdout_wr.writeAll("\n"); |
||
} |
} |
||
} |
|||
</syntaxhighlight> |