Ternary if

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

  1. a = 1 > 2 ? 3 : 4
  2. # The above is the same as:
  3. a = if 1 > 2
  4. 3
  5. else
  6. 4
  7. end