Chapter 4; Making Decisions
= vs ==
the first is a operator while the second is a assignment operator. The == operator determines whether a variable is equal to another value, the = operator assigns the value on the right to the value on the left
All relational operators are binary, which means that
they use two operands
How does a computer store what is true and what is false?
0 is false, all other are true 7
Relational Expressions are also known as..
Boolean expressions, which means that the value can only be true or false
Relational Operators Greater than Less than Greater than or equal to less than or equal to equal to not equal to
Relational Operators & what expression means x > y; Is x greater than y? x < y ; Is x less than y? x >= y ; Is x greater than or equal to y? x <= y ; Is x less than or equal to y? x == y ; Is x equal to y? x != y ; Is x not equal to why All relational operators have left to right associativity. Recall that associativity is the order in which an operator works with its operands
Relational Operators
Relational operators allow you to compare numeric and char values whether one is greater than, less than, equal to, or not equal to another
The if statement
The if statement can cause other statements to execute only under certain conditions
decision structure
a specificaction is taken when a spesific condition exsits
Sequence structure
a type of code in which the statements are executed in a sequence
x > y is called a
relational expression; it is used to determine whether x is less than y
z = x< y
relational expressions have a higher precedence than the assignment operator, worked out then assigned