RosettaCodeData/Task/Conditional-structures/Langur/conditional-structures-4.langur

26 lines
472 B
Text
Raw Permalink Normal View History

2024-07-13 15:19:22 -07:00
switch x, y, z {
2023-07-01 11:58:00 -04:00
case true: ...
# any are true
case false, _: ...
2024-07-13 15:19:22 -07:00
# x == false
2023-07-01 11:58:00 -04:00
case _, null, true: ...
2024-07-13 15:19:22 -07:00
# y == null or z == true
2023-07-01 11:58:00 -04:00
case xor _, true, true: ...
2024-07-13 15:19:22 -07:00
# y == true xor z == true
2023-07-01 11:58:00 -04:00
}
switch 0 {
2024-07-13 15:19:22 -07:00
case x, y: ...
# x or y equals 0
2023-07-01 11:58:00 -04:00
...
}
2024-07-13 15:19:22 -07:00
switch[and] x, y, z {
2023-07-01 11:58:00 -04:00
case true: ...
# all are true
case false, _: ...
2024-07-13 15:19:22 -07:00
# x == false
2023-07-01 11:58:00 -04:00
case _, null, true: ...
2024-07-13 15:19:22 -07:00
# y == null and z == true
2023-07-01 11:58:00 -04:00
}