Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
69 views

Assignment Operators

The = operator assigns the value on the right side to the left side variable. For example, var=5 assigns 5 to var. The +=, -=, *=, /=, and %= operators are assignment operators that perform the operation and assign the result back to the variable on the left side, such as a+=b being the same as a=a+b. These assignment operators make it easier to update variable values in a single statement.

Uploaded by

slspa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

Assignment Operators

The = operator assigns the value on the right side to the left side variable. For example, var=5 assigns 5 to var. The +=, -=, *=, /=, and %= operators are assignment operators that perform the operation and assign the result back to the variable on the left side, such as a+=b being the same as a=a+b. These assignment operators make it easier to update variable values in a single statement.

Uploaded by

slspa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment Operators

The most common assignment operator is = . This operator assigns the value in right side to the left side. For
example:
var=5

//5 is assigned to var

a=c;

//value of c is assigned to a

5=c;

// Error! 5 is a constant.

Operator

Example

Same as

a=b

a=b

+=

a+=b

a=a+b

-=

a-=b

a=a-b

*=

a*=b

a=a*b

/=

a/=b

a=a/b

%=

a%=b

a=a%b

You might also like