Showing posts with label while. Show all posts
Showing posts with label while. Show all posts

Friday, February 8, 2013

Excercise between W1 and W3

Week-3: 3.6: While

While:

Another type of loop you can use in Java is called the while loop. While loops are a lot
easier to understand than for loops. Here's what they look like:

while ( condition ) {

}

So you start with the word "while" in lowercase. The condition you want to test for goes
between round brackets. A pair of curly brackets comes next, and the code you want to
execute goes between the curly brackets. As an example, here's a while loop that prints
out some text (Try the code out for yourself):

int loopVal = 0;

while ( loopVal < 5) {
System.out.println("Printing Some Text");
loopVal++;
}

Visit For Details