|
![]() |
||||||||||||||
Primitive Data Types TutorialInteger OperatorsUsual arithmetical operators are supported: addition (+), subtraction (-), multiplication (*), division (/) and unary negation (-). The division of integer values computes an integer result. The integer division remainder operator is available (%). Bit-level integer operators are syntactically and semantically equivalent to these operators in programming language C: bit-level binary conjunction (&), bit-level binary disjunction (|) and bit-level unary complement (~). Multiplication, division, remainder and bit-level conjunction have higher priority than addition, subtraction and bit-level disjunction. Source code:{# 17 / 10, 17 % 10, 240 & 63, // '11110000' & '00111111' = '00110000' = 48 3 | 6, // '011' | '110' = '111' = 7 -5, ~5 // bit-level complement #} Result:{# 1, 7, 48, 7, -5, -6 #}
|
|
||||||||||||||
© 2006 Saša Malkov | |||||||||||||||