+ 1

How does the for loop work for printing even numbers in javascript

8th Apr 2018, 8:38 PM
Akindayo DaSaint Olugboji
Akindayo DaSaint Olugboji - avatar
2 odpowiedzi
+ 4
for i n range(100): if i%2 == 0: # the number is divisible by 2 print(i)
8th Apr 2018, 8:59 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 5
It depends on the language. Most allow steps of 2 so start with an even and it only gives evens.
8th Apr 2018, 9:01 PM
John Wells
John Wells - avatar