WHILE keyword loops statement inside it, until condition specified by it satisfies. There are often chances for WHILE loop to go into infinite loop, so we have to make sure to update necessary variables, if any inside while block.
Its syntax is very simple, as listed below.
Keyword CONTINUE is used if want to skip rest of statements in while loop, and go directly to condition evaluation part. BREAK keyword stops further execution and exits while loop.
It's said one practical is better than 100 theories. So let's take practical now.
Challenge: Print all odd numbers between 1 and 10.Solution: