見出し1
見出し2
見出し3
文法
printf
test
while not Keys.newPress.Start do -- 何かキーが押されるまで繰り返す
Controls.read()
startDrawing()
screen.print(SCREEN_UP, 0, 0, "Press START to quit")
screen.print(SCREEN_DOWN, 0, 0, "Hello Lua world!")
stopDrawing()
end
具体的なサンプル
この下をコピー&ペーストして修正するのが良いと思います。
これは、***文のサンプルです。
|構文|例:while 条件式 do ~ end|例:条件式が偽となるまで繰り返します|
#highlight(){{
-- while while.lua
while not Keys.newPress.Start do -- 何かキーが押されるまで繰り返す
Controls.read()
startDrawing()
screen.print(SCREEN_UP, 0, 0, "Press START to quit")
i = 0
while i < 5 do
screen.print(SCREEN_DOWN, 0, 8 * i, i)
i = i + 1
end
stopDrawing()
end
}}
実行結果
例:0回から1づつ増加して5未満までの回数は、5回(0~4)になります。
&ref(while.png)
最終更新:2010年10月09日 09:58