1 min read•june 18, 2024
Avanish Gupta
Milo Chang
Avanish Gupta
Milo Chang
Sometimes, we want to compare two numbers or see if two things are equal. To do this, we use boolean expressions, which represent logic and tell whether something is true or false. These are the two values that boolean primitive types can take!
There are several operators that can be used to create boolean expressions. Any statement containing these operators will result in a boolean. Here are the operators and what they do:
You can use boolean statements in conjunction with other operators as well, such as in the following statement: (a%2) == 0
This statement is asking if the value represented by a is even or not. If it is even, then we return true. If it is not, we return false.