How many bools can I connect?? e.g.

if((x>j) || (y<t) || (m=c) && (x != 0))

Please pardon any improper syntax, and any guidance is greatly appreciated

(My text doesn't go into great detail with bools, but we're working with classes right now, and in one example there are three "ors" connected in a bool - this type of the thing would be very helpful for my current homework project)

Thanx
Rick

Recommended Answers

All 2 Replies

> How many bools can I connect??
As many as you like

> How many bools SHOULD you connect?
Usually a lot less.
One set of && and one set of || is about the limit of what would be easy to understand and test for.

If you were being pedantic, each bool you add DOUBLES the number of tests you need to perform in order to prove the code is correct. If you get too creative, there's no way that you can test the code.

> How many bools can I connect??
As many as you like

> How many bools SHOULD you connect?
Usually a lot less.

Salem,
Thank you, your warnings and info. are heeded and appreciated

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.