< C++ Programming < Programming Languages < C++ < Code < Keywords

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.

first
truefalse
second truetruefalse
falsefalsefalse


Syntax

Below is an example using an if statement

if(first && second){
  printf("it is true");
}
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.