4. Slide 4
The built-in value types (continued)
• The integer data types can be used to store signed and unsigned
whole numbers of various sizes.
• Since the decimal type is the most accurate non-integer data type,
it’s typically used to store monetary values.
8. Slide 8
How to declare and initialize variables and
constants
• Before you can use a variable or constant, you must declare its
type and assign an initial value to it.
• To declare or initialize more than one variable for a single data
type in a single statement, use commas to separate the variable
names or assignments.
• To identify literal values as float values, you must type the letter f
or F after the number. To identify decimal values, you must type
the letter m or M after the number.
• The keywords for data types must be coded with all lowercase
letters.
9. Slide 9
Assignment operator
Operator Name Description
= Assignment Assigns a new value to the variable.
The syntax for a simple assignment statement
variableName = expression;
Typical assignment statements
counter = 7;
newCounter = counter;
discountAmount = subtotal * .2m;
total = subtotal – discountAmount;