9 ms·
The problem with these examples is that putOnCoat() should not depend in any way on itsSunny, so there should just be two separate if blocks. We should be discu
by jessaustin 11y ago
The problem with these examples is that putOnCoat() should not depend in any way on itsSunny, so there should just be two separate if blocks. We should be discussing a scenario in which one condition is a subset of the other.
- JustSomeNobody 11y agoWhy not? I've been on Rainier when it's cold and sunny.
- Jtsummers 11y agoBut it's an independent test. You'll put on your coat when it's cold, whether it's sunny or not.
- denis1 11y agoI you didn't understand what the GP said. You can certainly have a day when it is both sunny and cold, but the checks would look like this: if(isSunny){ putOnGlasses(); } if(isCold) { putOnCoat(); }
- Retric 11y agoDepends on context, in a game you might only send someone outside if it's sunny. So if it's !sunny your staying inside and you don't need a Coat.
- deleted 11y ago[deleted]