Instead of
you should be using
The "while" in the first clause applies to the next statement. The second version adds an empty statement (or block). An aternative for the "{}" is to use a ";" as empty statement as in
Leaving out the ":" or "{}" can be a difficult bug to detect!
If you are writing a multi-tasking program (i.e. doing two tasks at once), then you want to use the following which puts in a short delay and prevents the code from sucking up to much CPU time