Difference between revisions of "Actionscript"
From Wikicliki
(→loops) |
(→loops) |
||
Line 41: | Line 41: | ||
x = x + 1; // ...continue to trace x but add one each time | x = x + 1; // ...continue to trace x but add one each time | ||
}</pre></td> | }</pre></td> | ||
− | <td>they all print: | + | <td valign=top>they all print: |
<pre>101 | <pre>101 | ||
102 | 102 |
Revision as of 10:44, 16 June 2008
trace
var message = "Hi there"; trace (message); // prints "Hi there"
var message = "yellow"; trace ("big " + message + " truck"); // prints "big yellow truck"
conditionals
var message = "yellow"; trace ("big " + message + " truck"); // prints "big yellow truck" if (message == "yellow") { trace ("yes, i did say big yellow truck."); // prints "yes, i did say big yellow truck" }
loops
this sequence... trace (101); trace (102); trace (103); trace (104); trace (105); |
is equal to:
var x = 101; trace (x); x = x + 1; trace (x); x = x + 1; trace (x); x = x + 1; trace (x); x = x + 1; trace (x); |
is also equal to:
var x = 101; while (x <= 105) { // as long as x is less than 105... trace (x); x = x + 1; // ...continue to trace x but add one each time } |
they all print:
101 102 103 104 105 |