Wed 04 July 2018, in category Loop
A while loop is a similar construct to the for loop it allows you to iterate over a set of statements while the given expression is true. In our examples below, the while loop increments the i value as long as its less than 10.
while(i < 10)
{
System.out.println(i);
i++;
}
while(i < 10)
{
Console.WriteLine(i);
i++;
}
while True:
if i >= 10:
break
print(i)
i=i+1
while (i < 10 ) {
console.log(i);
i++;
}
for i < 10 {
fmt.Println(i)
i++
}