Skip to content

Commit aa3e128

Browse files
committed
improvement:operators lesson
1 parent 5b60da8 commit aa3e128

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"liveServer.settings.port": 5501
3+
}

lessons/operators.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ Relational operators are used to compare the values of two operands. They are us
7070

7171
Logical operators are used to perform logical operations. They are used to perform the following operations:
7272

73-
- `&&`: AND used to perform logical AND operation. It gives true if both the operands have true value.
74-
- `||`: OR used to perform logical OR operation. It gives true if either of the operands have true value.
73+
- `&&` and `&`: Java unlike many other languages has two AND operators to perform logical AND operation. It returns true if both the operands (being compared) have a truthy value.Even though both the `&` and `&&` operators perform the same AND operation ; the `&&` operator can improve the efficiency of your code since it evaluates the second expression only if the first expression is true unlike the `&` operator which evaluates the second expression nonetheless.
74+
75+
- `||` and `|`: OR used to perform logical OR operation. It returns true if either of the operands have a truthy value. The difference between `|` and `||` is that the `|` operator is a bitwise operator and it compares each operand bitwise whereas the `||` operator is the logical OR operator. It operates on both the operands and returns true if either of the operands have a truthy value.
7576
- `!`: NOT used to perform logical NOT operation. It gives true if the operand has false value.
7677

7778
let's see an example:

0 commit comments

Comments
 (0)