Consecutive 'if' statements
- by Ben Packard
How can I check one thing AND THEN another, if the first is true?
For example, say I have a shopping basket object, and I only want to do something if the basket has been created AND it isn't empty.
I've tried:
if (basket && [basket numberOfItems >0])...
But the second condition is evaluated even if the first fails, resulting in a…