Assign the loop variable in the last line of the loop; that way you won't have an uninitialised local variable.
Never write == true or == false. Not if (b == true)…, but if (b)… and not if (b == false)… but if (!b)
Christopher Laurenzano wrote:It's line 21; when I saw this I got confused -- I guess I don't understand it -- while what is true?
Stuart A. Burkett wrote:The general form of a while loop is
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
You're a bit late for that.Winston Gutkowski wrote: . . . (and before Campbell wades in
) . . .
Campbell Ritchie wrote:
You're a bit late for that.Winston Gutkowski wrote: . . . (and before Campbell wades in
) . . .
I still disagree about the bit about == true.
b == true is in itself a boolean expression, so that would have to be b == true == true
And that is a boolean so it becomes b == true == true == true
Etc, etc.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |