13 lines
276 B
Text
13 lines
276 B
Text
using System.Console;
|
|
|
|
module Closures
|
|
{
|
|
Main() : void
|
|
{
|
|
def f(x) { fun() { x ** 2 } }
|
|
def funcs = $[f(x) | x in $[0 .. 10]].ToArray(); // using array for easy indexing
|
|
|
|
WriteLine($"$(funcs[4]())");
|
|
WriteLine($"$(funcs[2]())");
|
|
}
|
|
}
|