1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-06-17 01:29:31 +00:00

fix type, add ternary explanation to lambda function

This commit is contained in:
David Schmenk 2017-11-20 13:14:09 -08:00 committed by GitHub
parent f84b95ec4b
commit 543f5fa338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1011,7 +1011,7 @@ Assignments evaluate an expression and save the result into memory. They can be
byte a
a = 0
```
Multiple assignement are supported. They can be very useful for returning more than one value from a function or efficiently swapping values around/
Multiple assignement are supported. They can be very useful for returning more than one value from a function or efficiently swapping values around.
```
predef bivalfunc#2
@ -1071,7 +1071,7 @@ def lambdas
return &(x, y, z) x * z / y // You can even return lambdas from definitions (these x, y are different from the locally defined x, y)
end
````
There are some limitations to lambda functions. They don't have any local variables except for the parameters. They can only return an expression; there are no control flow statements allowed. Lastly, they can only be defined inside another definition. They cannot be defined in global data space or in the module main function (it gets deallocated after initialization).
There are some limitations to lambda functions. They don't have any local variables except for the parameters. They can only return an expression; there are no control flow statements allowed, but the ternary operator can be used for simple `if-the-else` control. Lastly, they can only be defined inside another definition. They cannot be defined in global data space or in the module main function (it gets deallocated after initialization).
### Control Flow