mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-05 22:48:42 +00:00
16 lines
369 B
Text
16 lines
369 B
Text
|
|
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
|
||
|
|
}
|