0
if(condition1 and condition2){
   //body
}

If condition1 turns out to be false, will c++ compiler check for condition2 or will it directly return false?

  • 1
    In c++ if you have 2 conditions or more with **and** operation between them and the first condition is false. The second one will not be checked – dhiya Aug 22 '22 at 03:12

1 Answers1

1

What you described is called short-circuit evaluation and C++ does use it: if condition1 is false, condition2 will not be checked.

peoro
  • 25,562
  • 20
  • 98
  • 150