Difference between revisions of "While/ja"

From Second Life Wiki
Jump to navigation Jump to search
m
(LSOの場合について追加)
(3 intermediate revisions by 3 users not shown)
Line 3: Line 3:
|statement=while
|statement=while
|statement_header
|statement_header
|statement_desc=どちらの文も空文でもよい.
|statement_desc=いずれのステートメントが空でも可能です。
|statement_end=ループ
|statement_end=loop
|statement_end_desc=単文でも複合文でも空文でもよい.
|statement_end_desc=シングルステートメントでもブロックステートメントでも空のステートメントのいずれも可能です。
|p1_name=条件式|p1_desc=これが実行され真であれば '''ループ''' が実行される.
|p1_name=condition|p1_desc=これが実行されてtrueであれば '''loop''' が実行されます。
|constants
|constants
|spec
|spec
|caveats
|caveats
|examples=<pre>//単文
|examples=<pre>//シングルステートメント
integer a = 0;
integer a = 0;
integer b = 10;
integer b = 10;
Line 16: Line 16:
     llOwnerSay((string)(a++));
     llOwnerSay((string)(a++));
</pre>
</pre>
<pre>//ブロック
<pre>//ブロックステートメント
integer a = 0;
integer a = 0;
integer b = 10;
integer b = 10;
Line 25: Line 25:
}
}
</pre>
</pre>
<pre>//空文
<pre>//空のステートメント
integer a = 0;
integer a = 0;
integer b = 10;
integer b = 10;
Line 36: Line 36:
|also_articles
|also_articles
|also_footer
|also_footer
|notes={{LSLG|do-while}} ループは while ループや {{LSLG|for/ja|for}} ループより速い.
|notes={{LSLG|do-while/ja|do-while}} のループは while ループや {{LSLG|for/ja|for}} ループより LSO においては速いです。
|mode
|mode
|deprecated
|deprecated
|cat1=Conditional
|cat1=Conditional
|cat2
|cat2=Flow Control
|cat3
|cat3
|cat4
|cat4
}}
}}

Revision as of 01:36, 21 February 2013

while( conditionloop

•  condition これが実行されてtrueであれば loop が実行されます。
•  loop シングルステートメントでもブロックステートメントでも空のステートメントのいずれも可能です。


いずれのステートメントが空でも可能です。

詳細

条件の種類
条件
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);

ノート

do-while のループは while ループや for ループより LSO においては速いです。