Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
|
|
@ -0,0 +1,17 @@
|
|||
class Closures
|
||||
{
|
||||
Void main ()
|
||||
{
|
||||
// define a list of functions, which take no arguments and return an Int
|
||||
|->Int|[] functions := [,]
|
||||
|
||||
// create and store a function which returns i*i for i in 0 to 10
|
||||
(0..10).each |Int i|
|
||||
{
|
||||
functions.add (|->Int| { i*i })
|
||||
}
|
||||
|
||||
// show result of calling function at index position 7
|
||||
echo ("Function at index: " + 7 + " outputs " + functions[7].call)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue