Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
School/C# - Beginner (Denis)/Lesson 8/lesson_8.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (23 sloc)
1.09 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Как и во многих других языках программирования, в C# имеется базовая операция присваивания =, | |
// которая присвоивает значение правого операнда левому операнду: | |
int number = 23; | |
//Здесь переменной number присваивается число 23. Переменная number представляет левый операнд, | |
// которому присваивается значение правого операнда, то есть числа 23. | |
//Также можно выполнять множественно присвоение сразу нескольких переменным одновременно: | |
int a, b, c; | |
a = b = c = 34; | |
int a, b, c; | |
a = b = c = 34 * 2 / 4; // 17 | |
int a = 10; | |
a += 10; // 20 | |
a -= 4; // 16 | |
a *= 2; // 32 | |
a /= 8; // 4 | |
a <<= 4; // 64 | |
a >>= 2; // 16 | |
int a = 8; | |
int b = 6; | |
int c = a += b -= 5; // 9 | |
b -= 5(6 - 5 = 1) | |
a += (b -= 5)(8 + 1 = 9) | |
c = (a += (b -= 5))(c = 9) |