Combining Conditions With &&, || and !

Your port of Ruth’s script now posts the call for each morning, with the reason. One line is still missing. On a racing morning, the members’ page also says the race officer hasn’t confirmed yet, so nobody rigs a dinghy for a race that might still be called off.

That line needs two conditions at once, and Ruth’s Python joins them with and and not. In this lesson, you’ll port that test and find where JavaScript’s ! binds differently from Python’s not.

Wait for the Race Officer

The Python script prints the reminder only when the call is racing and the officer hasn’t confirmed it:

Language: Python
decision = "racing"
officer_confirmed = False
if decision == "racing" and not officer_confirmed:
    print("Waiting for the race officer to confirm")

On the main morning, both conditions hold, so the reminder appears. In JavaScript, the test uses symbols instead of words:

Language: JavaScript
const decision = "racing";
const officerConfirmed = false;
if (decision === "racing" && !officerConfirmed) {
  console.log("Waiting for the race officer to confirm");
}

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.