mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-25 13:07:13 +00:00
debug
This commit is contained in:
parent
582ad5668e
commit
0d62ae0814
29 changed files with 99479 additions and 1166 deletions
15
tests/match.lang
Normal file
15
tests/match.lang
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
def fruit_cost : fruit = {
|
||||
return (match fruit with
|
||||
| $Banana -> 11
|
||||
| $Apple | $Orange -> 7)
|
||||
}
|
||||
|
||||
def amount_to_string : x is_zero_separated = {
|
||||
const ans = match x with
|
||||
| 0 ? is_zero_separated -> "Zero"
|
||||
| 0 | 1 | 2 | 3 | 4 -> "Few"
|
||||
| x ? (5..9).contains x -> "Several"
|
||||
| x ? (10..19).contains x -> "Pack"
|
||||
| _ -> "Lots"
|
||||
return ans
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue