Wouter Oet wrote:And your if statement is incorrect.
There are actually two problems with the if statement. The one will be easy to spot because the compiler will give an error.
The other is a bit more difficult because once all the compiler errors are fixed, the code will actually work how the OP expects.
Bud - once you have the program compiling, run it and it should work as you expect. Now try changing line 6 to
and see what happens.