Say I have a conditional like this:
if (conditionOne && conditionTwo) {
// execute some code
}
If conditionOne
is false, does that prevent computing conditionTwo
? In many cases I don't want to compute conditionTwo
because it would throw an error if conditionOne
is false. For example, often times I want to make sure a particular property exists before I do anything with it. In the past I've used nested conditionals, but the && would save space and look cleaner in a lot of cases. I just want to make sure the second contrition will be left alone if the first is false.