
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Onward!
|
163
For the sake of brevity, ActionScript does not require curly braces when a condi-
tional has only one substatement. A single substatement can, quite legitimately, be
placed directly after an if or else if statement without any curly braces, like this:
if (x = = y) trace ("x and y are equal");
or even on the next line, like this:
if (x = = y)
trace ("x and y are equal");
For some programmers, this style can be a little slower to read and slightly more
error-prone, though it undeniably saves room in source code.
Onward!
Conditional statements are an immensely important aspect of ActionScript. They
give us precise control over the execution of our code. In the next chapter, we’ll
examine another kind of important execution-control statement, loops.