0

Why is the output of this codeblock 012?

As per my knowledge ++i should immediately increment the value and then print when called. So as per that the output should be 12 shouldn't it? But I still am not able to wrap my head around this. https://code.sololearn.com/cyG8dl05mQRL/?ref=app

17th Jul 2022, 9:20 PM
Abhishek Survase
Abhishek Survase - avatar
2 Answers
+ 6
The step parameter takes place after execution of the loop. To do what you want, drop the step parameter completly and preincrement i in the stop parameter. https://code.sololearn.com/cWcbBa8F4cA8/?ref=app
17th Jul 2022, 9:32 PM
Slick
Slick - avatar
+ 2
Slick Makes sense thanks for the help đŸ‘đŸ»
17th Jul 2022, 9:35 PM
Abhishek Survase
Abhishek Survase - avatar