Parentheses are used to call functions and methods, and to execute codeblocks. For example:

MyClass::MyMethod

is a function pointer to a method in the class, while

MyClass::MyMethod( )

actually calls that method. Any parameters to include in the call are placed inside the parentheses. Multiple parameters are separated by commas. Here is an example using a codeblock:

rootn = {|x,n| x^(1/n)} // Create expression codeblock with two parameters

? rootn( 27, 3 ) // Displays cube root of 27: 3

Some commands expect the names of files, indexes, aliases, and so forth to specified directly in command—"bare"—not in a character expression. Therefore, you cannot use a variable directly. For example, the ERASE command erases a file from disk. The following code will not work:

cFile = getfile( "*.*", "Erase file" ) // Store filename to variable

erase cFile // Tries to erase file named "cFile"

because the ERASE command tries to erase the file with the name of the variable, not the contents of the variable. To use the variable name in the file, enclose the variable in parentheses. In these commands, the parentheses evaluate the indirect file reference, and when used in this way, they are referred to as indirection operators:

erase ( cFile ) // Spaces inside parentheses optional

Macro substitution also works in these cases, but macro substitution can be ambiguous. Indirection operators are recommended in commands where they are allowed.

Finally, parentheses are also used for grouping in expressions to override or emphasize operator precedence. Emphasizing precedence simply means making the code more readable by explicitly grouping expressions in the normal order they are evaluated, so that you don’t need to remember all the precedence rules to understand an expression. Overriding precedence uses the parentheses to change the order of evaluation. For example:

? 3 + 4 * 5 // Multiplication first, result is 23

? ( 3 + 4 ) * 5 // Do addition first, result is 35