Log in from a computer to take this course

You'll need to log in from a computer to start Learn C++. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store

The or logical operator is denoted by ||.

It returns true when the condition on the left is true or the condition on the right is true. Only one of them needs to be true.

Here’s the truth table:

a b a || b
false false false
false true true
true false true
true true true

For instance:

  • ( 1 < 2 || 2 > 3 ) returns true
  • ( 1 > 2 || 2 > 3 ) returns false

Note: The keyword or can be used in the place of ||.



Write the following if statement:

  • If day is equal to 6 or day is equal to 7, then print the word "Weekend".

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?