While/ja

From Second Life Wiki
< While
Revision as of 19:51, 12 December 2007 by Coffee Mills (talk | contribs) (New page: {{Multi-lang}} {{LSL_Conditional/ja |statement=while |statement_header |statement_desc=どちらの文も空文でもよい. |statement_end=loop |statement_end_desc=Can be either a single ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to 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ではない場合は真。正しい動作は、Monoでコンパイルされたスクリプトのみで見られ、LSOでコンパイルされたスクリプトは誤って false になります。BUG-230728


//単文
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.