Java
  Home arrow Java arrow Page 2 - The JSP Files (part 3): Black Light An...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

The JSP Files (part 3): Black Light And White Rabbits
By: Vikram Vaswani and Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2001-03-01

    Table of Contents:
  • The JSP Files (part 3): Black Light And White Rabbits
  • Doing More With Loops
  • For-gone Conclusion
  • The Sound Of Breaking Loops
  • Paying The Piper
  • You Say Seven, I Say 7
  • A Positive Response

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    The JSP Files (part 3): Black Light And White Rabbits - Doing More With Loops


    (Page 2 of 7 )

    There's one caveat with the "while" loop. If the conditional expression evaluates as false the first time, the code within the curly braces will never be executed. If this is not what you want, take a look at the "do-while" loop, which comes in handy in situations where you need to execute a set of statements *at least* once.

    Here's what it looks like:


    do
    { do this! } while (condition)

    For example, the following lines of code would generate no output whatsoever, since the conditional expression in the "while" loop would always evaluate as false.


    <%
    int bingo = 366;

    while (bingo == 699) { out.println ("Bingo!"); break; }%>


    However, the construction of the "do-while" loop is such that the statements within the loop are executed first, and the condition to be tested is checked after. Using a "do-while" loop implies that the code within the curly braces will be executed at least once - regardless of whether or not the conditional expression evaluates as true.


    <% int bingo = 366;

    do { out.println ("Bingo!"); break; } while (bingo == 699); %>


    Try it yourself and see the difference.

    More Java Articles
    More By Vikram Vaswani and Harish Kamath, (c) Melonfire


     

       

    JAVA ARTICLES

    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup

    BlackBerry VTS




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway