Lesson Comparisons With The Logical And Operator

Rafael J. Rodriguez edited this page Jan 6, 2017 · 2 revisions

Author

Created by Rafase282

Lesson: Comparisons with the Logical And Operator

Sometimes you will need to test more than one thing at a time. The `logical and` operator `&&` returns `true` if and only if the `operands` to the left and right of it are true.

The same effect could be achieved by nesting an if statement inside another if:

```if (num > 5) {
if (num < 10) {
return "Yes";
}
}
return "No";```

will only return "Yes" if `num` is between `6` and `9` (6 and 9 included). The same logic can be written as:

```if (num > 5 && num < 10) {
return "Yes";
}
return "No";```

Full Stack Development Certification

1. Greefield Nonprofit Project 1
2. Greefield Nonprofit Project 2
3. Legacy Nonprofit Project 1
4. Legacy Nonprofit Project 2
5. Claim your Full Stack Development Certification

Coding Interview Preparation

1. Whiteboard Coding Interview Training
2. Critical Thinking Interview Training
3. Mock Interview 1
4. Mock Interview 2
5. Mock Interview 3
Clone this wiki locally
You can’t perform that action at this time.