Java Programming : Loops






Loops are control structures used to repeat a given section of code a certain number of times or until a particular condition is met. For example, we can design a program that adds a series of numbers until the sum exceeds a certain value. We can also write a program that prompts the user to enter data repeatedly until he or she enters the word ‘Finish’.

In Java, there are three types of Loops
 1. For-loop
2. While-loop
3. Do-while-Loop



=================================
Syntax; 

for( initialization; condition ; statement) {

Statement;

}
==================================








====================================
Syntax

while(condition) { 
statement; 


=====================================







===================================

Syntax

Do { 
Statement; 

} while(condition)

==================================








Walang komento:

Mag-post ng isang Komento