You can check this course on my website.
Assignment operators set the value of the right operand to the left operand. The most basic assignment operator that is found everywhere is =
Here, using the operator = we set the value of the age
variable. Also, you can simultaneously assign a value to several variables at once.
= — is right-associative operator, it means that first initializes z
, then y
, then x
. Let’s consider other assignment operators:
- += — addition assignment; Same as
x = x + 5;
- -= — subtraction assignment; Same as
x = x — 4;
- *= — multiplication assignment; Same as
x = x * 3;
- /= — division assignment; Same as
x = x / 2;
- %= — modulo assignment; Same as
x = x % 5;
Of course, C# has more assignment operators, but we’ll look at them later so you know how to use them.
Previous article -> 2.6 Arithmetic Operators
Next article -> 2.8 Comparison Operators
Join to our community in Telegram — https://t.me/itifico
If you want to support me, you can buy me a cup of coffee and I will drink it when I write the next article :)
Donations list:
- Dinesh Chintalapudi — 3$
- Unknown — 5$
- Neisy — 3$
- Unknown — 3$