Difference between revisions of "While Loops"
From CompSciWiki
Line 2: | Line 2: | ||
The while loop is a special form of loop that will continue to repeat as long as the [[#Test Condition|test condition]] evaluates to false. | The while loop is a special form of loop that will continue to repeat as long as the [[#Test Condition|test condition]] evaluates to false. | ||
==Syntax== | ==Syntax== | ||
− | + | In java, the while loop takes the form of | |
+ | <pre> | ||
+ | while(test condition) { | ||
+ | ... | ||
+ | statements | ||
+ | ... | ||
+ | } | ||
+ | </pre> | ||
+ | In this particular situation, the while loop will continue to iterate until the test condition evaluates to false. | ||
==Test Condition== | ==Test Condition== |
Revision as of 16:40, 20 February 2007
Contents
Introduction
The while loop is a special form of loop that will continue to repeat as long as the test condition evaluates to false.
Syntax
In java, the while loop takes the form of
while(test condition) { ... statements ... }
In this particular situation, the while loop will continue to iterate until the test condition evaluates to false.