0

While loop

Can we write "num++" on "num=num+1"..? And if no then why.?

6th Oct 2018, 9:12 AM
Kusum Paliwal
Kusum Paliwal - avatar
2 ответов
+ 2
Depends on what your while loop looks like. If you do it like this (see code sample), it does make a difference. I have to admit that this is usually not what you expect a while loop to look like though https://code.sololearn.com/cQZ8SDT9Fj8B/?ref=app
6th Oct 2018, 11:08 AM
Anna
Anna - avatar
+ 1
You can. num++ is short writing of num = num+1, that's why many programmers (maybe all of themm) use num++
6th Oct 2018, 9:51 AM
Mustafa K.
Mustafa K. - avatar