Jump statements implement one method of flow control in Simdify Scripting Language.
Details are as follows:
This example uses a return statement to return a value from a function.
function double GetPI()
{
return 3.1415;
}
This example uses a continue statement to selectively execute portions of a loop. It prints the values 1 through 10 to the Simdify application's output window, and if the value of x is less than 5, it prints the string x is less than 5 after printing the number.
for( int x = 0; x < 10; ++x )
{
Application.Log.LogString( x + 1 );
if( x >= 5 )
{
continue;
}
Application.Log.LogString( "x is less than 5" );
}
This example uses a break statement to terminate execution of an otherwise infinite loop. It prints the values 1 through 5 to the Simdify application's output window.
int x = 0;
while( 1 )
{
Application.Log.LogString( x + 1 );
if( x >= 4 )
{
break;
}
++x;
}