![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
Use the return
statement to return values from functions. The return
statement stops the function and replaces it with the value of the return
action. The following rules govern the use of the return
statement in functions:
return
statement in the function. return
statement.return
statement is optional. If you don't include one, an empty string is returned.For example, the following function returns the square of the parameter x
and specifies that the returned value must be a Number:
function sqr(x):Number { return x * x; }
Some functions perform a series of tasks without returning a value. For example, the following function initializes a series of global variables:
function initialize() { boat_x = _global.boat._x; boat_y = _global.boat._y; car_x = _global.car._x; car_y = _global.car._y; }
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |