more dics & minor bugs fixed
This commit is contained in:
1 parent
9a08da0dfd
commit
5591a66af3
5 files changed
+119
-5
No files matched your search
@@ -238,6 +238,8 @@ but Lyng syntax requires using the __lambda syntax__ to create such.
|
||||
|
||||
See lambdas section below.
|
||||
|
||||
## Declaring arguments
|
||||
|
||||
There are default parameters in Lyng:
|
||||
|
||||
fn check(amount, prefix = "answer: ") {
|
||||
@@ -250,6 +252,17 @@ There are default parameters in Lyng:
|
||||
check(120)
|
||||
>>> "answer: enough"
|
||||
|
||||
It is possible to define also vararg using ellipsis:
|
||||
|
||||
fun sum(args...) {
|
||||
var result = args[0]
|
||||
for( i in 1 ..< args.size ) result += args[i]
|
||||
}
|
||||
sum(10,20,30)
|
||||
>>> 60
|
||||
|
||||
See the [arguments reference](declaring_arguments.md) for more details.
|
||||
|
||||
## Closures
|
||||
|
||||
Each __block has an isolated context that can be accessed from closures__. For example:
|
||||
|
||||
Reference in new issue
Block a user