java loop

Java
// Will continue until condition is true
while (condition) {
  // Code block to be executed
}

// Will loop trough until i = 5 
int i = 0;
while (i < 5) {
  System.out.println(i);
  i++;
}for (int i = 0; i < 10; i++) {
  System.out.println(i);
}for (int i = 0; i < 5; i++) {
  System.out.println(i);
}
// Starting on 0:
for(int i = 0; i < 5; i++) {
  System.out.println(i + 1);
}

// Starting on 1:
for(int i = 1; i <= 5; i++) {
  System.out.println(i);
}


// Both for loops will iterate 5 times,
// printing the numbers 1 - 5.for(int i = 0; i < 10; i++)
{
  //do something
  
  //NOTE: the integer name does not need to be i, and the loop
  //doesn't need to start at 0. In addition, the 10 can be replaced
  //with any value. In this case, the loop will run 10 times.
  //Finally, the incrementation of i can be any value, in this case,
  //i increments by one. To increment by 2, for example, you would
  //use "i += 2", or "i = i+2"
}
Source

Also in Java: