Kotlin

Kotlin Assignment Operator Examples1 min read

Kotlin Code:

Output:




In Kotlin assignment operators assigns the value on its right to the operand on its left.

Operator ( = ) : Simple assignment operator. Assigns values from right side operands to left side operand ( a = b ).

Operator ( += ) : Add AND assignment operator. It adds right operand to the left operand and assign the result to left operand ( a +=b ).

Operator ( -= ) : Subtract AND assignment operator. It subtracts right operand from the left operand and assign the result to left operand ( a -= b ).

Operator ( /= ) : Divide AND assignment operator. It divides left operand with the right operand and assign the result to left operand ( a /= b ).

Operator ( %= ) : Modulus AND assignment operator. It takes modulus using two operands and assign the result to left operand ( a %= b ).

Leave a Comment