Loop over multiple arrays simultaneously: Difference between revisions
Loop over multiple arrays simultaneously (view source)
Revision as of 12:06, 16 May 2022
, 2 years agoadd Zig example
m (→{{header|Picat}}: Added {{out}}) |
(add Zig example) |
||
Line 4,341:
zip[With] stops at the end of the shortest sequence,
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}}==
|