Chapter 10. Statements and Operators

This chapter provides a reference-style overview of ActionScript’s statements and operators—many of which we’ve already seen in this book. Rather than discussing each statement and operator in isolation, this book teaches the use of statements and operators in the context of other programming topics. Accordingly, this chapter lists many crossreferences to discussion and usage examples found elsewhere in this book. For information on operators not covered in this book, see Adobe’s ActionScript Language Reference.

Statements

Statements are one kind of directive, or basic program instruction, consisting of a keyword (command name reserved for use by the ActionScript language) and, typically, a supporting expression.

Table 10-1 lists ActionScript’s statements, their syntax, and purpose.

Table 10-1. ActionScript statements

Statement

Usage

Description

break

break

Aborts a loop or switch statement. See Chapter 2.

case

case expression:
  substatements

Identifies a statement to be executed conditionally in a switch statement. See Chapter 2.

continue

continue;

Skips the remaining statements in the current loop and begins the next iteration at the top of the loop. See Adobe documentation.

default

default:
  substatements

Identifies the statement(s) to execute in a switch statement when the test expression does not match any case clauses. See Chapter 2.

do-while

do {
  substatements
} while (expression);

A variation of a while loop that ensures at least one iteration ...

Get Essential ActionScript 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.