Selection Statements

Selection statements implement one method of flow control in Simdify Scripting Language.

Details

Details are as follows:

Examples

This example tests if x is greater than 10 and clamps x to 10 if true.

if( x > 10 )
   x = 10;

This example tests if x is not equal to zero and uses x in a division operation if true. This selection statement might be used to avoid a divide by zero.

if( x != 0 )
{
   z = y * 2;
   y = z / x;
}

This example tests if x is greater than 5 and prints the string x is greater than 5 to the Simdify application's output window if true. It then uses an else clause to print the string x is less than or equal to 5 if false. This example outputs the string x is less than or equal to 5.

int x = 4;
if( x > 5 )
   Application.Log.LogString( "x is greater than 5" );
else
   Application.Log.LogString( "x is less than or equal to 5" );