Why is my for loop returning unexpected number on line 7? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is my for loop returning unexpected number on line 7?

https://code.sololearn.com/WY1Z3Va1kcKP/?ref=app Why is my code to print about 40 numbers incremented by 1 not working?

20th Apr 2017, 4:48 PM
AceDev
3 Answers
+ 6
@Paul, it's not because of that. It's because you can't do "i++1". You don't need that 1 at the end, because it increments "i" by itself. So this: i++1&&j++1 goes to i++&&j++ and i would recommend using a "," instead of the comparison statement "&&": i++, j++
20th Apr 2017, 4:59 PM
Tim G
Tim G - avatar
+ 2
i think it is the && between the i++ and the j++ the it with a ; The && is mostly used fit comparing.
20th Apr 2017, 4:56 PM
Paul
Paul - avatar
0
Thank you
20th Apr 2017, 6:55 PM
AceDev