mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 01:51:38 +00:00
Clarify inc/dec operators
This commit is contained in:
parent
f18a60dff4
commit
ef486c2119
@ -212,10 +212,10 @@ on a new line! ""Wow!"", the masses cried";
|
|||||||
// Incrementations
|
// Incrementations
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Console.WriteLine("\n->Inc/Dec-rementation");
|
Console.WriteLine("\n->Inc/Dec-rementation");
|
||||||
Console.WriteLine(i++); //i = 1. Post-Incrementation
|
Console.WriteLine(i++); //Prints "0", i = 1. Post-Incrementation
|
||||||
Console.WriteLine(++i); //i = 2. Pre-Incrementation
|
Console.WriteLine(++i); //Prints "2", i = 2. Pre-Incrementation
|
||||||
Console.WriteLine(i--); //i = 1. Post-Decrementation
|
Console.WriteLine(i--); //Prints "2", i = 1. Post-Decrementation
|
||||||
Console.WriteLine(--i); //i = 0. Pre-Decrementation
|
Console.WriteLine(--i); //Prints "0", i = 0. Pre-Decrementation
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
// Control Structures
|
// Control Structures
|
||||||
|
Loading…
Reference in New Issue
Block a user