Page 68 - Digicode_AI_class_7
P. 68

Operator         Symbol                Description                        Example


             Add AND                 +=      Adds the right operand to the left  b + = a (b + = 10) is
             assignment                      operand and assign the result to     equivalent to b = b + a (b =
             operator                        the left operand                     30 + 10) (b = 40)


             Subtract AND             -=     Subtracts the right operand from     b – = a (b– = 10) is
             assignment                      the left operand and assigns the     equivalent to b = b – a
             operator                        result to the left operand           (b=30-10) (b=20)



             Multiply AND            *=      Multiplies the right operand with    b *= a (b *= 10) is equivalent
             assignment                      the left operand and assigns the     to b = b * a
             operator                        result to the left operand           (b = 30 * 10) (b=300)


             Divide AND              /=      Divides the left operand with the    b /= a (b/ = 10) is equivalent
             assignment                      right operand and assigns the        to b = b / a
             operator                        result to the left operand.          (b = 30/10) (b=3)

             Modulus AND             %=      Takes modulus of two operands        b % = a (b% = 10) is
             assignment                      and assigns the result to the left   equivalent to b = b % a
             operator                        operand                              (b = 30 % 10) (b=0)


            What is Variable Initialization?

            To use variables in programming, first we need to create the variables and assign them a reference
            in the computer memory.
            Variable is a storage area which the programs can manipulate by changing the values stored in it.


































                66     DigiCode AI-VII
   63   64   65   66   67   68   69   70   71   72   73