Why 2016 I got the logic of 20 but not 16 | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
1st Nov 2020, 12:19 PM
Rai
Rai - avatar
3 Réponses
+ 4
*In very simple words Because the loop don't have any block, the variable m is increased by 1, because there's a semicolon right after the m++ operation that's where the scope of that for loops ends. So loop only works for variable m not for n. that's it, hope you understood.
1st Nov 2020, 12:27 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 2
There are no {}. Only the m++ line is in the for loop. n++ runs only once.
1st Nov 2020, 12:28 PM
Paul
Paul - avatar
+ 2
Thank you very much ..I understood now😄
1st Nov 2020, 1:18 PM
Rai
Rai - avatar