Answers for "how to while loop"

22

how to write a while statement in python

myvariable = 10
while myvariable > 0:
  print(myvariable)
  myvariable -= 1
Posted by: Guest on January-08-2020
1

python do while loop

while True:
  //do something
  if (""" break condition """):
    break
Posted by: Guest on November-20-2020
1

while loop

Create a loop that runs as long as i is less than 10.

var i = 0;

while(i < 10) {
	console.log(i); i++
}
Posted by: Guest on June-10-2021
0

while loop

Create a loop that runs as long as i is less than 10, but increase i with 2 each time.

var i = 0

while(i < 10){
	console.log(i);
    i = i + 2;
}
Posted by: Guest on June-10-2021
0

Example of While Loop

public class Test {

   public static void main(String args[]) {
      int x = 10;

      while( x < 20 ) {
         System.out.print("value of x : " + x );
         x++;
         System.out.print("n");
      }
   }
}
Posted by: Guest on August-31-2021

Python Answers by Framework

Browse Popular Code Answers by Language