Error getting tags :
error 404Error getting tags :
error 404 @ | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Expander triangle

See Also
Desktop, Web and Server
Platform Support
Mac OS X,Windows,Linux
None required
The character @ (at sign) is used with a parameter declaration, to indicate that a reference to the parameter is passed instead of its value.

on setVariable @incomingVar -- notice the @ before the parameter name
add 1 to incomingVar
end setVariable

on mouseUp
put 8 into someVariable
setVariable someVariable
answer "someVariable is now: " & someVariable
end mouseUp

Additional Comments
Expander triangle

The character @ is placed before a parameter name to pass a reference to the parameter instead of its value. Pass a parameter reference when you want a handler to change a variable in the calling handler, or when you want a handler to return more than one value.


Parameters to a handler are declared on the first line of the handler. If the name of a parameter is preceded with the @ character, that parameter's value is interpreted as a variable name, rather than the value in the variable. Changing the parameter variable in the called handler changes the value of the variable in the calling handler.

In the above example, the handler setVariable takes a parameter and simply adds 1 to it. Because the parameter for the handler is declared with a leading @, the mouseUp handler passes "someVariable" by reference. This means that when the setVariable handler makes changes to the parameter, it changes the actual variable, and those changes affect all further references in the mouseUp handler to the variable. Executing this mouseUp handler displays a dialog box that says "someVariable is now: 9"

User Comments
Expander triangle
User thumbnail
Oliver Kenyon
Sep 24, 2009
Passing a parameter by reference means that the data contained in the variable is not duplicated as is the case with normal parameter passing. This is useful in some cases for improving efficiency. Any situation where you are repeatedly passing a large variable to a handler could potentially be speed up by making it a reference parameter. Its important to keep track of which parameters are passed by reference to prevent unexpected behavior. I tend to use a prefix of "r" for reference parameters which a handler mutates ("return parameters", e.g. command getTimeAndDate @rTime, @rDate).