I just happened to reproduce and fix a bug in the IDE that was the result of code not being explicit about what was intended.
The particular bit of code was in a listbox cellkeydown handler and read
If me.ListIndex <> -1 and key = SpecialChars.EnterChar or key = SpecialChars.ReturnChar then
dim tag as string = me.CellTag(me.Listindex, 0)
But this was throwing an out-of- bounds exception sometimes when you'd press return. But, why?
If you look at the expression you will see that the boolean operators AND has a higher precedence
than OR. This means that
me.ListIndex <> -1 and key = SpecialChars.EnterChar
gets evaluated BEFORE the OR.
This expression turns out to behave as though you wrote
((me.ListIndex <> -1) AND (key = SpecialChars.EnterChar)) or (key = SpecialChars.ReturnChar)
The end result was IF you pressed return the code for the THEN portion WOULD execute when it should not and this caused the out of bounds exception.
What this expression should have said was:
(me.ListIndex <> -1) AND ((key = SpecialChars.EnterChar)) or (key = SpecialChars.ReturnChar))
So the listindex had to be <> -1 before the code in the then would execute.
A very small change, but a very big difference.
Be clear and be safe out there :P