control_flow/ternary.rb
tests/_examples/control_flow/ternary.rb in the metorex repository.
x = true ? "yes" : "no"
puts(x)
y = false ? "yes" : "no"
puts(y)
a = 10
result = a > 5 ? "big" : "small"
puts(result)
nested = true ? (false ? "a" : "b") : "c"
puts(nested)
Output:
yes
no
big
b