DADiSP Worksheet Functions > Function Categories > Control Flow > BREAK

 

BREAK

Purpose:

Terminates the immediately enclosing FOR, LOOP or WHILE loop.

Syntax:

BREAK

Example:

ValChk(s)
{
    local ns, ival;
 
    ns   = s;
    ival = max(deriv(ns));
 
    while (ival < 10)
    {
        ns   = deriv(ns);
        ival = max(ns);
 
        if (ival < 0) break;
    }
 
    return(ival);
}

 

In the SPL function, ValChk, if ival, the max of the derivative of the input series, s, is less than zero, then the break statement will break out of the while loop, and return the value.

Remarks:

BREAK also terminates the evaluation of comparisons in a SWITCH statement.

See Also:

CONTINUE

FOR

IF

LOOP

RETURN

SPL: Series Processing Language

SWITCH

WHILE