+ 2

Why for loop ending with ; gives error

16th Jul 2020, 9:08 PM
BALAJI RP
BALAJI RP - avatar
4 Respostas
+ 14
When you have a for loop that ends with a semicolon,(;) it means that there is no body for the loop. Basically its an empty loop. It can be useful for finding the length of a string, number of elements in a array, and so on.
16th Jul 2020, 9:14 PM
Shruti
Shruti - avatar
0
Thanks
16th Jul 2020, 9:15 PM
BALAJI RP
BALAJI RP - avatar
0
Thanks. Actually I didn't put the semicolon in between as I know it will give infinite loop
16th Jul 2020, 9:24 PM
BALAJI RP
BALAJI RP - avatar