49
UbiQ Scenario Manager User Manual
Chapter 4
B
asic of
Smart-C
S
cript
Language
for ( i = 0; i < LENGTH; i=i+1 ) /* Execution returns here when */
{
if ( lines[i] == 0 )
{
nLen = i;
break; /* break statement is executed */
}
}
The example processes an array of variable-length strings stored in lines. The break
statement causes an exit from the interior for loop after the terminating null character
(0) of each string is found and its position is stored in nLen.
continue statement
The continue statement passes control to the next iteration of the for, or while state-
ment in which it appears, bypassing any remaining statements in the for, or while
statement body. A typical use of the continue statement is to return to the start of a
loop from within a deeply nested loop.
Syntax
continue-statement :
continue;
The next iteration of a for, or while statement is determined as follows:
* Within a while statement, the next iteration starts by reevaluating the expression of
the while statement.
* A continue statement in a for statement causes the first expression of the for state-
ment to be evaluated. Then the interpreter reevaluates the conditional expression
and, depending on the result, either terminates or iterates the statement body.
This is an example of the continue statement:
while ( i > 0 )
{
x = sum( i );
if ( x == 1 )
continue;
y= y+x * x;
i=i-1;
}
In this example, the statement body is executed while i is greater than 0. First sum(i)
is assigned to x; then, if x is equal to 1, the continue statement is executed. The rest
Summary of Contents for UbiQ
Page 1: ...User Manual UbiQ Scenario Manager User Manual V1 03...
Page 4: ...UbiQ Scenario Manager User Manual iv...
Page 7: ...Chapter 1 1 Introduction...
Page 13: ...Chapter 2 2 Getting Started...
Page 37: ...Chapter 3 3 Tutorials...
Page 47: ...Chapter 4 4 Basic of Smart C Script Language...
Page 62: ...UbiQ Scenario Manager User Manual 56...