1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
if(condition, then-actions, else-actions*) if动作和其他语言的功能基本一致,进行最基本的条件成立与否判断. 参数: •condition ◦一个逻辑表达式(是否满足条件,返回真假). •then-actions ◦当条件为真时执行的动作. •else-actions (可选项) ◦当添加为假时执行的动作. 样例: if(fullscreen, fullscreensetup(), windowsetup() ); if(fullscreen, set(layer[controls].visible, false) ); if(i LT 10, loop(next) ); if(var === null, set(var,0)); if(hotspot[spot1] === null, trace(there is no spot1 hotspot)); if((varA GT 5) AND (varA LT 10), trace('varA is between 5 and 10') ); if(varA AND varB AND varC, trace('all vars are true') ); if(var1 GT var2, trace('condition is true'); lookto(100,20,50); , trace('condition is false'); lookto(0,0,100); ); if(a*2+b GT (c+3)*1.5 OR teststring == '123', ...); |