This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathat-symbol.lcdoc
More file actions
54 lines (40 loc) · 1.66 KB
/
at-symbol.lcdoc
File metadata and controls
54 lines (40 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Name: @
Type: keyword
Syntax: @
Summary:
The character @ (at sign) is used with a parameter declaration, to
indicate that a reference to the parameter is passed instead of its
value.
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
on setVariable @incomingVar -- notice the @ before the parameter name
add 1 to incomingVar
end setVariable
Example:
on mouseUp
put 8 into someVariable
setVariable someVariable
answer "someVariable is now: " & someVariable
end mouseUp
Description:
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"
References: $ (keyword)
Tags: properties