mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-26 15:13:56 +00:00
~~codeblock~~ lambda
This commit is contained in:
parent
dadefd1bdd
commit
ec44661bab
16
niva.md
16
niva.md
@ -208,7 +208,7 @@ c <- 3 // reset c
|
|||||||
c echo // 3 2 1
|
c echo // 3 2 1
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
`whileTrue:` is a message for codeblock of the type:
|
`whileTrue:` is a message for lambda object of the type:
|
||||||
`[ -> Boolean] whileTrue::[ -> Unit]`
|
`[ -> Boolean] whileTrue::[ -> Unit]`
|
||||||
|
|
||||||
#### Matching
|
#### Matching
|
||||||
@ -322,15 +322,21 @@ Person foo = [
|
|||||||
#### Compile time reflection
|
#### Compile time reflection
|
||||||
You can get string representation of any argument from a call site.
|
You can get string representation of any argument from a call site.
|
||||||
```Scala
|
```Scala
|
||||||
Foo bar::Int baz::String = [
|
Int bar::Int baz::String = [
|
||||||
// getting string representation from call side
|
// getting string representation from call side
|
||||||
a = Compiler getName: 0
|
a = Compiler getName: 0
|
||||||
b = Compiler getName: 1
|
b = Compiler getName: 1
|
||||||
c = Compiler getName: 2
|
c = Compiler getName: 2
|
||||||
a echo
|
a echo // 1 + 1
|
||||||
b echo
|
b echo // variable
|
||||||
c echo
|
c echo // "str"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
variable = 42
|
||||||
|
// call side
|
||||||
|
1 + 1
|
||||||
|
bar: variable
|
||||||
|
baz: "str"
|
||||||
```
|
```
|
||||||
|
|
||||||
Links:
|
Links:
|
||||||
|
Loading…
Reference in New Issue
Block a user