( ) (parentheses)
Grouping operator in expressions (treat any expression as a factor)
Example:
put 5 * (3 + 8) --> 55
Used around parameters in a function call expression
Example:
put average(2,4,6,8) --> 5
Used (required) around the selector operator
Example:
put (if x then y else z) into res
Used to treat the value of any expression as an identifier
Example:
set foo.("prop" & 1) to 7 --> sets foo's "prop1" property to 7
Used to treat the value of any expression as an object for obtaining a property using 's and '.'
Example:
put ("script" & 2)'s counter
Used to apply a unit to the value of an expression when it is followed by a unit name
Example:
set height to (a + b) inches
Used optionally in a variety of situations
- used optionally around formal parameter declaration
- used optionally around parameter value
- used optionally around factor list
- used optionally around helper list
- used optionally around a container
Used around lists or property lists instead of [ ] or
ノート
SenseTalk is very accommodating about the brackets used for collections, allowing any of ( ), [ ], or { } around both lists and property lists. However, it is strongly encouraged to always use { } for property lists, and [ ] for lists.