Proposed an addition in for loop (#32990)

This commit is contained in:
Abhishek
2018-11-01 03:30:34 +05:30
committed by Paul Happ
parent 7e013616b0
commit 7a90dbe515

View File

@ -68,6 +68,8 @@ System.out.println("The sum of the first 50 numbers is: " + 50);
### Extras
One thing to keep in mind is that for is also an entry controlled loop just like while loop, where condition is checked at the beginning. So, do keep that in mind before writing the starting condition of the loop.
You cannot use a number (old C-style language construct) or anything that does not evaluate to a boolean value as a condition for an if statement or looping construct. You can't, for example, say if(x), unless x is a boolean variable.
Also, it is important to keep in mind that the boolean expression must, at some point, evaluate to true. Otherwise, your program will be stuck in an infinite loop.