C++ and Keyword
Example
The and keyword gives the same result as the && operator:
int x = 3;
cout << (x < 5 and x < 10) << "\n";
cout << (x < 5 && x < 10);
Definition and Usage
The and keyword is another way to write the logical && operator. It returns true (1) if both conditions are true. Otherwise it returns false (0).
and and && work in exactly the same way. Most C++ programmers use &&, but some think that and is easier to read.
Related Pages
Read more about logical operators in our C++ Logical Operators Tutorial.