fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 252: Conditional assignment
Idiom # 252: Conditional assignment
See
programming-idioms.org
:
Code
Code input
# using ternary operator x := condition ? "a" : "b" # using if-else statement x := if condition then "a" else "b"
What are effects?
Runnable Example
Code input
ex252 is for counter in 1..4 do condition => counter %% 3 x := condition ? "a" : "b" say x for counter in 5..8 do condition => counter %% 3 x := if condition then "a" else "b" say x
What are effects?
last changed: 2026-02-20
next: NYI: Idiom # 253: Print stack trace