Any pros/cons to using the “and” operator vs the && operator? I personally think “and” is only going to cause confusion (ironically).
If there aren’t any differences, why does it exist? It seems silly and unnecessary.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
They’re anachronisms – they were originally introduced to accomodate folks who didn’t have “^” or “|” characters on their keyboards.
Furthermore, although “and” and “&&” are equivalent … “and” and “&” are quite different. Using “and” instead of “&&” is simply confusing on a number of different levels, for several different reasons. Including giving the poor maintenance programmer a completely unnecessary “wtf?” experience.
I would not use them in any code. And I’ve certainly never seen them used in any “live” code.
IMHO…
Here’s a bit more on the topic, if you’re interested:
The written versions of the logical operators
http://www.cplusplus.com/reference/ciso646/
https://en.cppreference.com/w/cpp/language/operator_alternative