A.6.4 compound-assignment operators – Campbell Scientific CR800 and CR850 Measurement and Control Systems User Manual
Page 472

Appendix A. CRBasic Programming Instructions
472
• bits 5-4: value_2
• bits 3-0: value_3
Code to extract these values is shown in CRBasic example Using Bit-Shift
Operators
(p. 473).
With unsigned integers, shifting left is equivalent to multiplying by two. Shifting
right is equivalent to dividing by two.
<<
Bitwise left shift
Syntax
Variable = Numeric Expression >> Amount
>>
Bitwise right shift
Syntax
Variable = Numeric Expression >> Amount
&
Bitwise AND assignment ‐‐ Performs a bitwise AND of a variable with an
expression and assigns the result back to the variable.
A.6.4 Compound-assignment operators
Table 113. Compound-Assignment Operators
Symbo
l
Name Function
^=
Exponent
assignment
Raises the value of a variable to the power of an expression and
assigns the result back to the variable.
*=
Multiplication
assignment
Multiplies the value of a variable by the value of an expression and
assigns the result to the variable.
+=
Addition
assignment
Adds the value of an expression to the value of a variable and
assigns the result to the variable. Also concatenates a String
expression to a String variable and assigns the result to the
variable.
-=
Subtraction
assignment
Subtracts the value of an expression from the value of a variable
and assigns the result to the variable.
/=
Division
assignment
Divides the value of a variable by the value of an expression and
assigns the result to the variable.
\=
Division integer
assignment
Divides the value of a variable by the value of an expression and
assigns the integer result to the variable.