Return - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

return

Availability
Flash Player 5.
Usage
return[expression]
Parameters
A string, number, Boolean, array, or object to evaluate and return as a value of the
expression
function. This parameter is optional.
Returns
The evaluated
expression
Description
Statement; specifies the value returned by a function. The
and returns the result as a value of the function in which it executes. The
expression
statement causes execution to return immediately to the calling function. If the
is used alone, it returns
You can't return multiple values. If you try to do so, only the last value is returned. In the
following example,
return a, b, c ;
If you need to return multiple values, you might want to use an array or object instead.
Example
The following example uses the
the added value of the three parameters. The next line of code calls
returned value to the variable
function sum(a:Number, b:Number, c:Number):Number {
return (a+b+c);
}
var newValue:Number = sum(4, 32, 78);
trace(newValue);
See also
function
712
Chapter 2: ActionScript Language Reference
ActionScript Language Reference
parameter, if provided.
undefined.
is returned:
c
statement inside the body of the
return
.
newValue
// output: 114
statement evaluates
return
return
function to return
sum()
and assigns the
sum()
CHAPTER 2
return
statement

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash mx

Table of Contents