Multiple conditions

We can also check for more than a single condition in one if statement by using two ampersand symbols, &&.

For example, we may want to check on the condition of two variables at once and only carry out our instructions if the variables' values are as specified. We would write the following code snippet:

if(speed >= 3 && grounded == true){ 
  //do something 
} 

If we wanted to check for one condition or another being true, then we can use two vertical line characters, ||, in order to mean OR. We would write this as follows:

if(speed >= 3 || grounded == true){ 
  //do something 
} 

This means that the commands within the if statement will run if at least one of the conditions is met.