More about “while”
Initialize the conditions which are evaluated in the “while”.
Conditions are evaluated at the “top” of while statement or before the execution of the body.
“while” body is executed 0 or more times.
Updating of the conditions are done inside the body of the “while”.
Use “while” when the number of times a loop is executed is dependent on some condition set during execution of the body.
- Example: Input a list of positive number. The list is terminated by a negative number.