25 lines
681 B
Text
25 lines
681 B
Text
using System;
|
|
using System.Console;
|
|
|
|
module LoopMultiple
|
|
{
|
|
Zip3[T1, T2, T3] (x : list[T1], y : list[T2], z : list[T3]) :
|
|
list[T1 * T2 * T3]
|
|
{
|
|
|(x::xs, y::ys, z::zs) => (x, y, z)::Zip3(xs, ys, zs)
|
|
|([], [], []) => []
|
|
|(_, _, []) => throw ArgumentNullException()
|
|
|(_, [], _) => throw ArgumentNullException()
|
|
|([], _, _) => throw ArgumentNullException()
|
|
}
|
|
|
|
Main() : void
|
|
{
|
|
def first = ['a', 'b', 'c'];
|
|
def second = ["A", "B", "C"];
|
|
def third = [1, 2, 3];
|
|
|
|
foreach ((x, y, z) in Zip3(first, second, third))
|
|
WriteLine($"$x$y$z");
|
|
}
|
|
}
|