Need help, (x)++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Need help, (x)++

int x = 42; do { Console.WriteLine(x); x++; } while(x < 10); I don’t really understand the «x++;» what does it do?

24th Nov 2017, 8:57 PM
frans lol
frans lol - avatar
3 Answers
+ 1
it is the same as "x=x+1", you actually adding 1 to your variable. so in your case x = 42 + 1
24th Nov 2017, 9:04 PM
Sipelo Nokele
Sipelo Nokele - avatar
0
Just faster way to write x=x+1
24th Nov 2017, 9:26 PM
Обрадовић Андрија
Обрадовић Андрија - avatar
0
x++ means add number 1to your int ex( 42+1) but ++x. or x--means substruct 1 ex(42_1)
24th Nov 2017, 10:11 PM
chedni