mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
update docs to better explain -> operator
This commit is contained in:
parent
4022b44ff9
commit
db9c00ec1e
1 changed files with 6 additions and 1 deletions
|
@ -5645,11 +5645,16 @@ All branches in an `if` must have the same type!
|
||||||
5│ 1 -> True
|
5│ 1 -> True
|
||||||
^^
|
^^
|
||||||
|
|
||||||
The arrow -> is only used to define cases in a `when`.
|
The arrow -> is used to define cases in a `when` expression:
|
||||||
|
|
||||||
when color is
|
when color is
|
||||||
Red -> "stop!"
|
Red -> "stop!"
|
||||||
Green -> "go!"
|
Green -> "go!"
|
||||||
|
|
||||||
|
And defining functions:
|
||||||
|
|
||||||
|
increment = \n -> n + 1
|
||||||
|
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue