Loop over multiple arrays simultaneously: Difference between revisions
Content added Content deleted
m (→{{header|Picat}}: Added {{out}}) |
(add Zig example) |
||
Line 4,341: | Line 4,341: | ||
zip[With] stops at the end of the shortest sequence, |
zip[With] stops at the end of the shortest sequence, |
||
which means it can work with infinite sequences |
which means it can work with infinite sequences |
||
=={{header|Zig}}== |
|||
<lang zig>const std = @import("std"); |
|||
const a1: []const u8 = &[_]u8{ 'a', 'b', 'c' }; |
|||
const a2: []const u8 = &[_]u8{ 'A', 'B', 'C' }; |
|||
const a3: []const u8 = &[_]u8{ '1', '2', '3' }; |
|||
pub fn main() !void { |
|||
for (a1) |_, i| |
|||
try std.io.getStdOut().writer().print("{c} {c} {d}\n", .{ a1[i], a2[i], a3[i] }); |
|||
}</lang> |
|||
=={{header|ZX Spectrum Basic}}== |
=={{header|ZX Spectrum Basic}}== |