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
Learn

The not logical operator is denoted by !.

It reverses the bool outcome of the expression that immediately follows.

Here’s the truth table:

a !a
false true
true false

For instance:

  • ( !true ) returns false
  • ( !false ) returns true
  • ( !(10 < 11) ) returns false

Note: The keyword not can be used in the place of !.

Instructions

1.

Write the following if statement:

  • If the user is !logged_in, then print the phrase "Try again".

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?