# 【Lua】【流程控制】if

####  

```Lua
if true then
  print("if block")
elseif true then
  print("elseif block")
else
  print("else")
end
```

```Lua
if not true then
  print("not true")
else
  print("else")
end
```

#### <span style="color: #ff0000;">elseif</span> 中間<span style="background-color: #ffff00;">沒有空白</span>要注意

```Lua
if true then
  print("if block")
else if true then
  print("elseif block")
else
  print("else")
end
end

-- 其實等於

if true then
    print("if block")
else 
    if true then
        print("elseif block")
    else
        print("else")
    end
end

```