Operator ( ) Foundation
Execution operator: executes functions, procedures and methods as well as delimiting groups of expressions.
<FuncName>([<Parameters,...>])
<ProcName>([<Parameters,...>])
:<MethodName>([<Parameters,...>])
(<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.
// This example shows different possibilities for the use
// of parentheses.
PROCEDURE Main
// 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
ENDIF
RETURN
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.