elseIf
if
文に引き続いた複数のif文を許す。 この構文によりさまざまな条件式とそれに伴うブロックコマンドが実行される。
書式:
if condition expression
then
条件が真のとき実行されるコマンド
elseIf alternativeCondition
expression then
最初の条件式が偽で次の条件式が真である場合の実行されるコマンド
{ elseIf ...
then }
{....}
end if
例:
setautoback(50)
prints("press a number key")
waitKey
x$=chr$(inkey)
if x$="1" then
prints("press 1")
elseif x$="2" then
prints("press 2")
else
prints("press other key")
end if
if x$="4" then :prints("good bye"):end if
prints("press esc to exit")
waitKey (27)
似た構文として if
... thenも参照のこと。
参照: if ...
then ... end if and else