Writing while and do..while statements
You can write
while
while (condition) {
// statements
}
You can write
do-while
do {
// statements
} while (condition);
Writing return statements
Don't use parentheses [()] with any return statements that have values. The only time to use
parentheses with
return
the third line of the following ActionScript code snippet:
return;
return myCar.paintColor;
// parentheses used to make the return value obvious
return ((paintColor)? paintColor: defaultColor);
Writing switch statements
All
statements include a default case.
switch
The default case is the last case in a
statement that prevents a fall-through error if another case is added.
If a case does not have a break statement, the case will fall through (see
following code example).
Your statement should include a comment in the
in the following example after
both cases A and B execute.
770
Best Practices and Coding Conventions for ActionScript 2.0
statements using the following format:
statements using the following format:
statements is when they make the value more obvious, as shown in
switch
. In this example, if the condition matches case A,
case A
statement. The
default
statement's place, as you can see
break
case includes a
break
in the
case A
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?