C# Increment Operators in 1 Minute: Pre vs Post Explained!

preview_player
Показать описание
Here's a concise description of pre-increment and post-increment in C#:
Pre-increment (++variable): Increments the variable's value by 1, then returns the incremented value.
Post-increment (variable++): Returns the variable's current value, then increments the variable's value by 1.
Example: For int x = 1; int y = ++x; int z = x++;:
y will be 2 and x will be 2 after ++x.
z will be 2 and x will be 3 after x++.
Рекомендации по теме