This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use Of Continue in do While Loop

 
Aniruddha Jadhao
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
is there no use of continue in do While loop?

please look in following code

public class Continue {

public static void main(String [] a){
boolean flag =true;
int i=0;
do{
flag= false;
System.out.println(i++);
flag = i<10;

continue;//here with it/with out the same out put

}while(flag?true:false);
}
}
 
S Thiyanesh
Ranch Hand
Posts: 142
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A continue statement will always check the condition in loops and proceeds the next iteration.
In your example, the continue statement will not bypass the loop condition.

try


Hope this one does the purpose of printing only the values of i >= 5 and i <= 10
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic