C++ Programming/Programming Languages/C++/Code/Keywords/and

From Wikibooks, open books for an open world
Jump to navigation Jump to search

The and keyword && short notation are used as logical operators. If both statements return a true, then the and statement will true. The and statement is often used inside the if statement.

Result table

Below is a table that shows the solution of two items with an and statement.

true false
second true true false
false false false


Below is an example using an if statement

if(first && second){
  printf("it is true");