Glossary
!=
The 'not equal to' relational operator, which checks if two values are different from each other.
Example:
A program might check username != 'admin' to ensure a user is not equal to the administrator account.
<
The 'less than' relational operator, which checks if the value on the left is numerically smaller than the value on the right.
Example:
A loop might continue as long as counter < 10, meaning the counter is less than ten.
<=
The 'less than or equal to' relational operator, which checks if the left value is smaller than or the same as the right value.
Example:
A discount might apply if totalCost <= 50, meaning the total cost is less than or equal to $50.
==
The 'equal to' relational operator, which checks if two values are exactly the same.
Example:
In a quiz, answer == 'Paris' would check if the user's input is equal to the correct answer.
>
The 'greater than' relational operator, which checks if the value on the left is numerically larger than the value on the right.
Example:
To determine if a player has enough points for a bonus, you might check if playerScore > 1000.
>=
The 'greater than or equal to' relational operator, which checks if the left value is larger than or the same as the right value.
Example:
For a ride eligibility, height >= 48 checks if a person's height is greater than or equal to 48 inches.
AND Operator
A logical operator that returns true only if all the conditions it combines are true; otherwise, it returns false.
Example:
A student passes if grade >= 70 AND attendance >= 90%; both conditions must be true for the AND Operator to yield true.
Boolean Logic
A system of logic that deals with true and false values, forming the basis for decision-making in computer science.
Example:
When a game checks if a player has enough coins to buy an item, it uses Boolean Logic to determine if the condition is met.
Boolean Variables
Variables that can store only one of two possible values: true or false.
Example:
A variable named isLoggedIn could be a Boolean Variable, set to true if a user is logged in and false otherwise.
Conditional Statements
Programming constructs (like if/else) that execute different blocks of code based on whether a given Boolean condition is true or false.
Example:
An app uses Conditional Statements to display a 'Welcome Back!' message if isReturningUser is true, or a 'Sign Up' prompt otherwise.
Logical Operators
Operators (NOT, AND, OR) used to combine or modify Boolean expressions, allowing for more complex conditions.
Example:
To check if a user is both logged in and has admin privileges, you would use Logical Operators to combine those two conditions.
NOT Operator
A logical operator that reverses the Boolean value of an expression; true becomes false, and false becomes true.
Example:
If isRaining is true, then NOT isRaining would evaluate to false, indicating it is not raining.
OR Operator
A logical operator that returns true if at least one of the conditions it combines is true; it only returns false if all conditions are false.
Example:
A movie ticket is discounted if age <= 12 OR isSenior is true, meaning either being young or a senior qualifies for the OR Operator to yield true.
Operator Precedence
The specific order in which different operators are evaluated within a single expression, similar to order of operations in mathematics.
Example:
Understanding Operator Precedence is crucial because NOT A AND B is evaluated as (NOT A) AND B, not NOT (A AND B).
Relational Operators
Symbols used to compare two values, producing a Boolean (true or false) result based on their relationship.
Example:
To check if a student's score is passing, you might use Relational Operators like score >= 70.
Truth Tables
Tables that systematically list all possible input combinations for a Boolean expression and the resulting output (true or false).
Example:
Studying Truth Tables helps predict the outcome of complex logical expressions, like (A AND B) OR C for all possible values of A, B, and C.