◆制御構文
fouループ
for i = 1, 10 do
print(i)
end
whileループ
while true do
str = io.read()
if str == "exit" then
break
else
print(str)
end
end
repeatループ
repeat
i = i + 1
print(i)
until 5 < i
if分岐
a = io.read()
if a == 1 then
a = a + 10
print(a)
elseif a == 2 then
a = a + 20
print(a)
else
print(a)
end
0 件のコメント:
コメントを投稿