Glossary
Boolean Expression
A statement in programming that evaluates to either `true` or `false`, forming the basis for decision-making and control flow.
Example:
In a game, playerScore > 100 is a boolean expression that determines if a bonus is awarded.
Boolean Value
One of the two possible outcomes of a boolean expression: `true` or `false`.
Example:
The boolean value of isLoggedIn might be true if a user has successfully authenticated.
Comparison Operators
Symbols used to compare two values, resulting in a boolean `true` or `false` outcome.
Example:
Using comparison operators like == or < allows you to check if a student's grade is passing.
Equality Operator (==)
Compares two values to check if they are identical, returning `true` if they are, and `false` otherwise.
Example:
To check if a user's input matches the secret password, you'd use userInput == secretPassword with the equality operator.
Greater Than Operator (>)
Compares two numerical values, returning `true` if the left operand is strictly larger than the right operand.
Example:
To see if a high score has been beaten, you'd use currentScore > highScore with the greater than operator.
Greater Than or Equal To Operator (>=)
Compares two numerical values, returning `true` if the left operand is larger than or equal to the right operand.
Example:
To grant access to users who are 18 or older, you'd use userAge >= 18 with the greater than or equal to operator.
Inequality Operator (!=)
Compares two values to check if they are different, returning `true` if they are not identical, and `false` otherwise.
Example:
If you want to ensure a username is not 'admin', you'd use username != "admin" with the inequality operator.
Less Than Operator (<)
Compares two numerical values, returning `true` if the left operand is strictly smaller than the right operand.
Example:
To determine if a player has less than 10 health points, you'd use playerHealth < 10 with the less than operator.
Less Than or Equal To Operator (<=)
Compares two numerical values, returning `true` if the left operand is smaller than or equal to the right operand.
Example:
To check if a package weight is within the limit of 50 kg, you'd use packageWeight <= 50 with the less than or equal to operator.
false
A boolean value indicating that a condition is not met or a statement is logically incorrect.
Example:
If isDaylight is false, the program might activate night mode.
true
A boolean value indicating that a condition is met or a statement is logically correct.
Example:
If temperature > 25 is true, the air conditioning will turn on.