
上QQ阅读APP看书,第一时间看更新
Allowed operators
The Swift standard library provides a number of operators that can be used to define custom operators. Custom operators can begin with one of the ASCII characters -/, =, -, +, !, *, %, <, >, &, |, ^, ?, ~, or one of the Unicode characters. After the first character, combining Unicode characters is allowed.
We can also define custom operators that begin with a dot. If an operator does not start with a dot, it cannot contain a dot elsewhere. Although we can define custom operators that contain a question mark (?), they cannot consist of a single question mark character only. Additionally, although operators can contain an exclamation point (!), postfix operators cannot begin with either a question mark or an exclamation point.