Module 6 · Loops and Jump Statements
do while: the Loop That Runs at Least Once
Free with an accountReading
Maria's till asks for a quantity, and it has to ask at least once. There is nothing to check until somebody types a number. It also has to refuse 0, because a quantity of 0 is not an order. It is a customer who changed their mind at the counter.
Sign in to read
This lesson is free, with an account
An account costs nothing and opens every lesson in this track that is not marked Pro, on every device you read on.
What is inside do while: the Loop That Runs at Least Once
- do while: the body first, the question after
- The semicolon after while
- Zero passes or one: the same false condition in both loops
- Asking until the answer is valid
- Clearing a bad line, and stopping when input ends
- A menu that runs until 0
- while or do while?