• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

for loop

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

//When it break the loop and reach to point why it do not came again in
loop ?
Thanks in advance
payal
[This message has been edited by payal sharma (edited July 27, 2001).]
[This message has been edited by payal sharma (edited July 27, 2001).]
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Break means exit the curent loop. I think you want to use "continue", wich skips the current iteration (that is "jumps to the endbracket of the loop").
/Mike
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Payal
Been looking a your posts and alot of them have more than just a couple of lines of code in them. It is much easier to read the code you post if you use the code tags from the ubb.
check this out: http://www.javaranch.com/ubb/ubbcode.html
Dave
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by payal sharma:

//When it break the loop and reach to point why it do not came again in
loop ?


Hi, Payal,
point is just a label for your for loop. It's not a label that you "goto" since Java doesn't allow gotos. When you say "break point;" you're telling the program to break out of the loop labeled as point. This is very handy when you have complex nested loops and want to break out of multiple layers of for loops at one time. You could also say "continue point;" In your example there's no need for the label as the label becomes useful with more than one block construct.
April
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Payal,
{ break < label > } specifies that the loop marked with label has to be exited.If you want to go to the next iteration in the for loop, i.e., if you want to stay in the loop, you need to use, the keyword { continue }.
Also you may use the { break < label > } , if you have multiple for loops.In your case, just { break } keyword would have terminated the loop.
Hope this helps,
Sandeep
SCJP2, OCSD(Oracle JDeveloper), OCED(Oracle Internet Platform)
[This message has been edited by Desai Sandeep (edited July 28, 2001).]
 
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic