Program Flow

C Styled Script
Reference Manual

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using The CSS Executive
Language
   Comments
   Literals
   Var And Const
   Operators
   Statements And blocks
   Program Flow
   Exception Handling
   Functions
   Predefined Identifiers
Directives
System Library
String Library
Regular Expression Lib.
File Library
Database Library
C API
C++ API
CSS Links
  

if / else

if (expression) statement-1 [else statement-2]

If expression evaluates true statement-1 is executed, otherwise statement-2. The else-part is optional.

switch / case / default / break

switch (expression-0)
{
  case expression-1: [statements]
  [case expression-2: [statements]]
  ...
  [case expression-N: [statements]]
  [default: statements]
}

expression-0 is compared with expression-1 ... expression-N. As soon as a match is found, all subsequent statements within the switch block are executed. The statements after default are executed if none of the previous expressions was matched.

Within the statements, break is used to leave the switch block premature.

Note that unlike C, expression-1 ... expression-N don't have to be constants.

while / break / continue

while (expression) statement

While expression evaluates true statement is executed. (The check is done before statement is executed).

The loop may be left premature by break. With continue the rest of statement is skipped and the loop continues with the next expression check.

do / while / break / continue

do statement while (expression)

statement is repeated until expression becomes false. (The check is done after statement execution).

The loop may be left premature by break. With continue the rest of statement is skipped and the loop continues with the nextexpression check.

for / break / continue

for ([expression-1]; [expression-2]; [expression-3]) statement

expression-1 is executed once as initializer. As long asexpression-2 evaluates true statement and expression-3 are executed in sequence. If expression-2 is not present, it is taken as permanently true.

The loop may be left premature by break. Withcontinue the rest of statement is skipped and the loop continues with the next expression-3 followed by the expression-2 check.

 Copyright © IBK LandquartLast revised by Peter Koch, 24.02.00<< Back  Top  Next >>