Operators
Nim allows user defined operators. An operator is any combination of the following characters:
= + - * / < >
@ $ ~ & % |
! ? ^ . : \
(The grammar uses the terminal OPR to refer to operator symbols as defined here.)
These keywords are also operators: and or not xor shl shr div mod in notin is isnot of as from.
. =, :, :: are not available as general operators; they are used for other notational purposes.
*: is as a special case treated as the two tokens * and : (to support var v*: T).
The not keyword is always a unary operator, a not b is parsed as a(not b), not as (a) not (b).
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .