Combining Conditions

Learn to use the AND and OR operators in the if statements.

We'll cover the following

and and OR

We can combine conditions that go right after the if statement. Sometimes, we need to perform multiple checks:

if ...
  puts ...
end

There are two ways of combining the conditions: AND and OR. Each way can be represented by the characters && (double ampersand) and || (double pipe).

Example

Get hands-on with 1400+ tech skills courses.