Learn

Our last logical operator is the not (!) operator. It negates (reverses) the value of a boolean. For example:

bored := true fmt.Println(!bored) // Prints false tired := false; fmt.Println(!tired) // Prints true

Notice that the ! operator will either take a true value and pass back false, or it will take a false value and pass back true.

Let’s see how to incorporate the ! operator.

Instructions

1.

In main.go add a ! operator to the if condition so that "What are we waiting for??" is printed to the terminal.

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?