Skip to content

Ternary if

The ternary if allows writing an if in a shorter way:

a = 1 > 2 ? 3 : 4

# The above is the same as:
a = if 1 > 2
      3
    else
      4
    end