Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
Write a simple WHILE loop that counts down from 5 to 1.
Use 'i -= 1' to decrement i each iteration.
What happens if you leave the condition always true in a WHILE loop?
Think about what needs to change to prevent it from running forever.
What does a WHILE loop do?
Think about what defines 'repeating' in programming.
True or False: A WHILE loop can run indefinitely.
Consider what would make a loop stop executing.
Create a WHILE loop that continuously asks the user for their age until a valid age (between 0 and 120) is entered. Display a message about aging based on the input.
Think about how to validate the input and break the loop upon success.
Imagine a game where you are guessing a number. Create a WHILE loop that keeps asking the user to guess a number between 1 to 100 until they guess correctly. Provide hints if they guess too high or too low.
Consider how you'll guide the user based on their guesses.
5 more questions in this section. Enroll free to practise them all.
Enroll free