Operator ( ) Foundation

Execution operator: executes functions, procedures and methods as well as delimiting groups of expressions.

<FuncName> is the name of a function to be executed.
<ProcName> is the name of a procedure to be executed.
<MethodName> is the name of a method to be executed.
<Parameters,...> is an optional list of parameters to be passed to a function, procedure or method. Multiple parameters are separated by commas.
<Expression,...> is a comma separated list of expressions which are executed in the order they are listed in <Expression,...>.
For functions and methods, the result of the execution operator is the return value of the executed function or method. With procedures, the result is always NIL. When several expressions are grouped with parentheses, the result is the value of the last expression in the list <Expression,...>.

Parentheses may be used to group expressions on a single program line in any manner. The parentheses can be nested (()) as deeply as needed and determine the order in which the expressions are evaluated. With multiply nested parentheses the expressions in the deepest level are evaluated first. Expressions on the same level are evaluated following normal operator precedence and from left to right.

When a function or procedure name precedes the opening parenthesis, the appropriate function or procedure is executed. Any expressions between the opening and closing parentheses are passed to the function or procedure as arguments. Accordingly, the function or procedure name is always outside the parentheses and the arguments are always inside. The same is true with the execution of methods, where the name of the executing method must be sent to an object using the send operator.

The execution operator ()
// This example shows different possibilities for the use 
// of parentheses. 

                                    // order of execution: 
                                    // multiplication first 
   ?  4 + 2  * 10                   // result: 24 

                                    // order of execution: 
                                    // addition first 
   ? (4 + 2) * 10                   // result: 60 

                                    // two function calls 
   ? CDow( Date() )                 // result: Tuesday 

   DispBox( 10, (2*5), MaxRow(), 40)// function call with 
                                    // multiple arguments 

   IF (n:=At("e","Xbase++")) > 0    // order: At(), :=, > 
      ? n                           // result: 5 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.