Selection statement (Definition)

A means of selecting one or other code block to be executed.

Selection statements provide a means of executing one of several possible blocks of code. The simplest is the if( ... ) selector. The next most complex is the if( ... ) ... else ... selector.

A similar and related concept is the condition execution operator ?: which is functionally very similar to an if (...) ... else ... selection.

The ECMAScript standard reserves the switch, case and default keywords at edition 2 and mandates that they be supported functionally at edition 3.

See also:Conditionally execute (?:), else ..., if( ... ) ..., if( ... ) ... else ..., switch( ... ) ... case: ... default: ...