refers to the means of specifying computations in a program
expressions
operators can be (3)
types of expressions (3)
on types of expressions:
used to specify mathematical computations
arithmetic expressions
on types of expressions:
used to compare two values
relational expressions
on types of expressions:
used for boolean operations and may sometimes require operands to be of boolean type
boolean expressions
design issues of expressions (4)
on design issues of expressions:
partially define what order the operators would be executed
operator evaluation order
on design issues of expressions:
defines which use of variables in the expression create a side-effect
operand evaluation order
occurs when a subprogram changes the value of an operand that will be used later in the expression
side-effect
solutions to side-effect (2)
on design issues of expressions:
operators having multiple uses
operator overloading
on design issues of expressions:
whether we should allow a programmer to define a different operation for an operator
operator overloading
on design issues of expressions:
are values allowed to be converted
type conversions
conversion to a type that can store all approximations of the original type
widening conversion
conversion to a type that cannot even store approximations of the original type
narrowing conversion
type of conversion that is done by the compiler based on the operand types
implicit type conversion (coercion)
type of conversion that is requested by the programmer
explicit type conversion (typecast)
types of conversion (4)
happens when the result is determined without completely evaluating the expression
short-circuit evaluation
allows the programmer to dynamically change the binding of values to variables
assignment statements
types of assignment statements (5)
what type of assignment statement is shown below?
number = 124
simple assignment
what type of assignment statement is shown below?
if flag:
a = 0
else:
b = 0conditional targets