für und während Schleifen Java
for (let i = 1; i <=5; ++i) {
// body of loop
}
SAMER SAEID
for (let i = 1; i <=5; ++i) {
// body of loop
}
do {
// code block to be executed
}
while (condition);
do
{
// do something
} while (true);
// this will print 1 to 10.
int ctr = 1;
while(ctr <= 10)
{
System.out.println(ctr); // print ctr value
ctr++; // increment ctr value by 1
}
int ctr = 1;
do
{
System.out.println(ctr); // print ctr value
ctr++; // increment ctr value by 1
}while(ctr <= 10);
while(condition) {
}