fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 225: Declare and use an optional argument
Idiom # 225: Declare and use an optional argument
See
programming-idioms.org
:
Code
f(T type, x option T) => x ? t T => say "x is present $t" | nil => say "x is not present"
What are effects?
Running Example
ex225 is f(T type, x option T) => x ? t T => say "x is present $t" | nil => say "x is not present" f 42 f "some text" f String nil # the following does not work yet, see https://github.com/tokiwa-software/fuzion/issues/121 # f nil # f nil nil f -1⁄12 f "Die Würde des Menschen ist unantastbar.".split
What are effects?
last changed: 2024-07-01
next: Idiom # 226: Delete last element from list