let a = 2; let b = 3; let f1 = [a](n: Int) -> Int { return a * n; }; let f2 = [b](n: Int) -> Int { return b * n; }; let f3 = [a, b](n: Int) -> Int { return a + b * n; }; let f4 = [a, b](n1: Int, n2: Int) -> Int { return a * n1 + b * n2; }; let f5 = [b, a](n1: Int, n2: Int) -> Int { return a * n1 + b * n2; }; if f1(5) != 10 || f2(5) != 15 || f3(5) != 17 || f4(5, 7) != 31 || f5(5, 7) != 31 { panic("This should not happen"); } let i = -1; let count = [i]() { i.inc(); return *i; }; let c0 = count(); let c1 = count(); let c2 = count(); let c3 = count(); if c0 != 0 || c1 != 1 || c2 != 2 || c3 != 3 { panic("This should not happen"); }