While loops
While Loop in Computer Programming
Example in Python
counter = 1
while counter <= 5:
print(counter)
counter += 1Example in C#
int counter = 1;
while (counter <= 5)
{
Console.WriteLine(counter);
counter++;
}Last updated
Was this helpful?