另一种写法

控制流 / 条件语句 / if/else 语句

local latitude = -42

-- Parentheses are allowed, not needed
local location
if (latitude == 0) then
  location = "Equator"
elseif (latitude < 0) then
  location = "Southern Hemisphere"
else
  location = "Northern Hemisphere"
end
-- location = Southern Hemisphere

-- The whole if on one line
local sign = "+"
if latitude < 0 then sign = "-" end
-- sign = -

-- else if opens a nested if with its own end
local side
if latitude == 0 then
  side = "none"
else
  if latitude < 0 then
    side = "south"
  else
    side = "north"
  end
end
-- side = south

print("location = " .. location)
print("sign = " .. sign)
print("side = " .. side)