From 7a90dbe5154a87fe8df75597b4e606045bc75fda Mon Sep 17 00:00:00 2001 From: Abhishek <31904912+singh-abhisheksingh@users.noreply.github.com> Date: Thu, 1 Nov 2018 03:30:34 +0530 Subject: [PATCH] Proposed an addition in for loop (#32990) --- guide/english/java/loops/for-loop/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guide/english/java/loops/for-loop/index.md b/guide/english/java/loops/for-loop/index.md index cfbe8d8f4c..55f71f8936 100644 --- a/guide/english/java/loops/for-loop/index.md +++ b/guide/english/java/loops/for-loop/index.md @@ -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.