+ 2
It says less than or equal to 4 It starts counting at 0 0 1 2 3 4 And because you do the + 1 It goes 0+1 = 1 1+1 = 2 Etc Etc 4+1 = 5 <= is the same as “less than or equal to”
9th Mar 2022, 10:15 PM
Brave Tea
Brave Tea - avatar
+ 5
It's due to A<=4. When A is 4, the loop goes on to A = 5 and outputs. Then A<= is evaluated again, now false, and stops
9th Mar 2022, 10:15 PM
Lisa
Lisa - avatar
+ 2
Btw, try switching the A+=1 and the print statement around. The order matters here and it is good to realise the difference
9th Mar 2022, 10:30 PM
Brave Tea
Brave Tea - avatar
+ 1
clear 0 1 2 3 4 count them they're five you saying add one till you are equal or smaller than 4 so the app is doing but it starts at zero index that's the reason.
9th Mar 2022, 10:18 PM
Erfan Mostafavi