-- 流程控制：if／for／while／function／delay_ms。
local function square(x)
  return x * x
end

check(square(5) == 25, "square(5) == 25")

local sum = 0
for i = 1, 5 do
  sum = sum + i
end
check(sum == 15, "for-loop sum 1..5 == 15")

local n = 0
while n < 3 do
  n = n + 1
end
check(n == 3, "while-loop counted to 3")

delay_ms(1)

if sum > n then
  log("info", "sum is bigger than n")
else
  log("info", "sum is not bigger than n")
end
