COP2253 Zybooks Chapter Two Flashcards
variable
a named item used to hold a value
assignment
assigns a variable with a value
an assignments left side must be a
variable
= symbol is
an assignment of a left-side variable with a right-side value (NOT equality as in mathematics)
incrementing
increasing a variables value by 1
variable declaration
a statement that declares a variable, specifying the variable’s name and type
assignment statement
a statement that assigns the variable on the left-side of the = with the current value of the right-side expression
expression
a combination of items, like variables, literals, operators, and parentheses, that evaluates to a value
an integer appearing in an expression is known as an
integer literal
identifier
a case-sensitive name created by a programmer for an item like a variable or method
reserved word (or keyword)
a word that is part of the language that cannot be used as an identifier
camel case
abuts multiple words, capitalizing each word except the first
literal
a specific value in code
operator
a symbol that performs a built-in calculation (like +-*/)
when an expression evaluates to a value it
replaces the expression
precedence rules
in order:
unary -
*/%
+-
left-to-right
~~~
```
unary minus -
minus used as a negative
compound variables
shorthand way to update a variable (ex. +=)
Should you include commas in an integer literal?
NO
floating-point number
a real number containing a decimal point that can appear anywhere (or “float”) in the number
double variable
stores a floating-point number