Do not wait to strike till the iron is hot; but make it hot by striking....
Joanne
Joanne Neal wrote:If you are testing booleans use either if (hasFlat) if you're testing if it's true or if (!hasFlat) if you're testing if it's false.
That way you avoid writing
if (hasFlat = true)
instead of
if (hasFlat == true)
which is what you've done in a couple of places.
Edit: Note that this applies to conditions in while loops as well
Seetharaman Venkatasamy wrote:That's perfect Jeff . Joanne Neal advised to OP about his post == at OP's last statement. [I think ]
Paul Clapham wrote:Back to another part of your original question:
This sort of thing happens so often that it has a name, and even its own Wikipedia page: Off-by-one error.
Christina Bremmerman wrote:
Ah I know of this...and I guess I missed it because of my other issues
I can either change the 100 to 101 or change the 99 to 98? Would it work as well to change >99 to ==99?
We can walk to school together. And we can both read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|