跳至內容

三元 if

三元 if 允許以更簡短的方式撰寫 if

a = 1 > 2 ? 3 : 4

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