update docs to better explain -> operator

This commit is contained in:
Lunarmagpie 2022-12-22 21:00:58 -05:00
parent 4022b44ff9
commit db9c00ec1e
No known key found for this signature in database
GPG key ID: 157C5FCADDCAA093

View file

@ -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
"### "###
); );