Assignment operator is used to assign a value in a variable.
The left side operand of the assignment operator is variable and right side operand of the assignment operator is value.
For example : num = 10
. Here num
is variable and 10
is value.
The value 10
is assigned to variable num
.
The assignment operators are :
= | Simple assignment |
+= | Add AND assignment |
-= | Subtract AND assignment |
*= | Multiple AND assignment |
/= | Division AND assignment |
%= | MOdulus AND assignment |
<<= | Left shift AND |
>>= | Right shift AND |
&= | Bitwise AND |
^= | Bitwise exclusive OR |
|= | Bitwise inclusive OR |
0 Comments