While/ja

From Second Life Wiki
< While
Revision as of 18:51, 12 December 2007 by Coffee Mills (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

while( conditionloop

•  condition If this executes as true then loop is executed.
•  loop Can be either a single statement, a block statement, or a null statement.


どちらの文も空文でもよい.

詳細

条件の種類
条件
integer 0ではない場合は真。
float 0ではない場合は真。
string 文字列の長さが0ではない場合は真。
key keyが有効でNULL_KEYではない場合のみ真。
vector vectorがZERO_VECTORではない場合は真。
rotation rotationがZERO_ROTATIONではない場合は真。
list listの長さが0ではない場合は真。


//単文
integer a = 0;
integer b = 10;
while(a < b)
    llOwnerSay((string)(a++));
//ブロック
integer a = 0;
integer b = 10;
while(a < b)
{
    llOwnerSay((string)a);
    ++a;
}
//空文
integer a = 0;
integer b = 10;
while(a++ < b);

ノート

A do-while loop is faster than a while loop or a for loop.