Potential confusion over the implication of [ ] characters in operator descriptions vs. other uses e.g. regex and literal strings
Operator Syntax. Square brackets
[ ] are used when documenting the optional parts of operator syntax, but are not (normally) used when employing the operator in actual action code. Otherwise, except for special cases listed below, do not type square brackets when creating code. Thus the example of the indented(N[,"item"]) operator, if using both operators the code entered would be like
indented(4,"Project X"), noting that absence of square brackets.
For special cases where square brackets are used in literal operator syntax see:
- the attribute Dictionary data type.
- the List/Set[itemNumber] list item address operator. This is essentially an array accessor and is also used in some JSON and XML contexts. It is also an alternate syntax to List/set.at(ItemNumber).
Therefore if square brackets appear in code syntax examples—as opposed to general syntax code example descriptions—it will imply one of the above uses.
Square brackets can of course occur in values within the code, include code examples for using operators:
- as literal strings:
"This string contains [square brackets] because it can".
- in regular expressions ('regex') as part of the matching pattern definition: