Square or Round Brackets?
Although parentheses, or round brackets, are the more common notation for containing the arguments of a function, the Expression Engine also permits use of square brackets ([ and ]) instead. You may prefer the use of square brackets to differentiate function arguments from logical parentheses.
The following example features round parentheses used for both function arguments and logical notation:
( 4 + Mod( 13, Sqrt( 16 ) ) );
Although this is a perfectly valid way of writing your code, with so many sets of parentheses involved you may you may find it easier to write it as follows:
( 4 + Mod[ 13, Sqrt( 16 ) ] );
Differentiating between the two types of brackets and their purpose might help you keep track of how many sets of brackets you have open when writing expressions.
For the remainder of this book, we will be using round brackets to represent both function arguments and logical notation. You are encouraged to use whichever brackets makes most sense for you to represent your function arguments – perhaps try one method then the other, so you can decide which one you prefer.
<< Previous: Introducing Functions | Next: Sum >>