return (keyword)
Usage
-- Lingo syntax
return expression
Description
Keyword; returns the value of
argument can be any Lingo value.
When calling a handler that serves as a user-defined function and has a return value, you must use
parentheses around the argument lists, even if there are no arguments, as in the
function handler discussed under the entry for the
The function of the
also returns a value to whatever called the handler. The
immediately exits from that handler, but it can return a value to the Lingo that called it.
The use of
return
using
to create functions and exit handlers. Later, you will see that the
return
an
handler gives you a way to pass back a reference to an object that was created so it can
on new
be assigned to a variable name.
The
keyword isn't the same as the character constant
return
return. The function depends on the context.
To retrieve a returned value, use parentheses after the handler name in the calling statement to
indicate that the named handler is a function.
To see an example of
Scripts movie in the Learning/Lingo Examples folder inside the Director application folder.
Example
This handler returns a random multiple of 5 between 5 and 100:
on getRandomScore
theScore = 5 * random(20)
return theScore
end getRandomScore
Call this handler with a statement similar to the following:
thisScore = getRandomScore()
In this example, the variable
getRandomScore()
reference, the variable name in the calling code provides a handle for subsequent references to
that object.
See also
result,
RETURN (constant)
expression
keyword is similar to that of the
return
in object-oriented scripting can be difficult to understand. It's easier to start by
return (keyword)
is assigned the return value from the function
thisScore
. A parent script performs the same function: by returning the object
and exits from the handler. The
function.
result
exit
command in a handler
return
RETURN
used in a completed movie, see the Parent
expression
diceRoll
command, except that
return me
, which indicates a carriage
return (keyword)
return
line in
223
Need help?
Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?
Questions and answers