Torque 3D - Script Manual: Statements

TorqueScript

Main   Class List   Namespace List   Online

Statements

   statement
      : iteration_statement
      | branching_statement
      | block_statement
      | expression_statement
      | empty_statement

Iteration Statements

   iteration_statement
      : for_statement
      | while_statement
      | do_statement
      | foreach_statement
      | foreachstr_statement

for Statement

while Statement

do Statement

foreach Statement

   foreach_statement
      : 'foreach' '(' variable 'in' expression ')' statement

The foreach statement iterates over all objects contained in a SimSet.

Example:
   foreach( %obj in RootGroup )
      echo( %obj.getName() );

foreach$ Statement

   foreachstr_statement
      : 'foreach$' '(' variable 'in' expression ')' statement

The foreach$ statement iterates over all words in a string. Words are separated by newlines, spaces, and/or tabs.

Example:
   foreach$( %str in "a b c d" )
      echo( %str );

Field Manipulators

Branching Statements

if Statement

   if_statement
      : 'if' '(' expression ')' statement
      | 'if' '(' expression ')' statement 'else' statement

switch Statement

switch Statement

return Statement



Copyright © GarageGames, LLC. All Rights Reserved.