|Home | Tutorial | Classes | Functions | QSA Workbench | Language | Qt API | QSA Articles Qt Script for Applications

[Prev: label] [Home] [Next: switch]

return

return optExpression;

A return statement may occur anywhere within a function, including member functions, but not within constructors. When a return statement is encountered, control leaves the function immediately, and execution resumes at the statement following the call that invoked the function. If the return statement is followed by an expression (optExpression) the value of the expression is returned to the caller.

Example:

    function inRange( v, min, max )
    {
        if ( v >= min && v <= max ) {
            return true;
        }
        else {
            return false;
        }
    }

[Prev: label] [Home] [Next: switch]


Copyright © 2001-2006 TrolltechTrademarks
QSA version 1.1.5