Asked • 06/22/19

Check severeal boolean returns in same time?

I have several bool elements and I am checking it if returns me false. bool i = false; switch (idcount) { case 1: i = p1(); break; case 2: i = p1() & p2(); break; case 3: i = p1() & p2() & p3(); break; case 4: i = p1() & p2() & p3() & p4(); break; case 5: i = p1() & p2() & p3() & p4() & p5(); break; case 6: i = p1() & p2() & p3() & p4() & p5() & p6(); break; case 7: i = p1() & p2() & p3() & p4() & p5() & p6() & p7(); break; } return i; I want if one of p*() returns false in any case i returns false. Is it right way or two false returns true? I want all p*() return true i returns true..

1 Expert Answer

By:

Patrick B. answered • 06/23/19

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.