7.5. Compact Conditional SyntaxThroughout this book we use statement blocks (statements surrounded by curly braces) with all conditional statements, even if a block contains only one statement:
For the sake of terseness, ActionScript does not require curly braces when a conditional has only one substatement. A single substatement may quite legitimately be placed directly after an if or an else if statement without any curly braces, like this:
Or like this:
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.
Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|