moved back to old acc
[vox.git] / test / syntax / funcdef.vx
blobafbf39478ca67f01a6540404c90610bd42ca6801
2 # "regular" function definition:
4 function mul(a, b)
6     return a*b
8 println(mul(5, 5))
10 # functions don't need braces, as long as the next statements
11 # form an expression:
12 function hi(val)
13     if(typeof val == "string")
14         println("Hi ", val, "!")
15     else
16         println("Hi value ", val.tostring().quote(), "!")
17 hi("World")
18 hi(mul(4, 2))
20 # anonymous functions (lambdas):
21 stuff := function(whoosh)
23     return whoosh