Sorry dude but that isn't right.
I did leave out a semicolon, but it is not where you think it is.
If ReturnMenu is equal to 'Y' then you an ifinite loop, because the ; creates a null statement.
You need to understand what a compound statement is.
1 2 3 4 5 6 7 8 9 10 11 12
|
while(test-expression) // no semicolon
single statement; // semicolon this is executed only if test-expression is
// false
// execution jumps to here if test-expression is false
while(test-expression) { // no semicolon the braces indicate a compound
// statement
// these are executed only if test-expression is
// true
muliple statements; // semicolon affter each one
}
// execution jumps to here if test-expression is false
|
Can you see now where the ; should go?
A compound statment can appear any where a single statement can.
The same idea applies to if, for, switch etc. Functions definitions are always in braces.
I normally use braces around single statements as a defensive measure. When you come to add more lines later, this can save you.
Perhaps I should explain how the loops work in detail - I am not sure you have fully got it yet. Looking at the code above for a while loop:
The test-expression is evaluated, if true then the statement (or compound statement) is executed, if test-expression is false then execution continues with the next line of code
after the statement (or compound statement). This procedure is repeated (loops around).
I think you should look at the examples in the reference section of this site, for all the things you want to use.
Cheers TheIdeasMan