Variables Practice Text Version |
Slide 1 Naming Variables
Slide 2 Naming Variables On the following slides, you will practice choosing good variable names. Remember, variable names should describe the value. Type Mismatch errors are common when working with variables. Always make sure the TYPE of variable matches the TYPE of value.
Slide 3 Question: 1 Which variable should be used
A = a
Slide 4 Question: 2 Which variable should be used to Which variable name is more meaningful? A = employee$
Slide 5 Question: 3 Which variable should be used to Which variable name is more meaningful? A = c
Slide 6 Question: 4 Which variable should be used to Which variable name is more meaningful? A = m$
Slide 7 Question: 5 The number of laps run by Spencer Which variable should you use? A = laps
Slide 8 Question: 6 An employee named Mike Which variable should you use? A = Mike
Slide 9 Question: 7 Fortune 500 company named Which variable should you use? A = company$
Slide 10 Question: 8 The number of butterflies, ants, and bees Which variable should you use? A = butterfly, ant, bees
Slide 11 Question: 9 Names of major league baseball Which variable should you use? A = pitcher1, pitcher2, pitcher3
Slide 12 Question: 10 LET car = “Hummer” Will an error result? A = no error
Slide 13 Question: 11 LET car$ = “Hybrid” Will an error result? A = no error
Slide 14 Question: 12 LET number = 1 Will an error result? A = no error
Slide 15 Question: 13 LET number$ = “1” Will an error result? A = no error
Slide 15 Question: 14 LET number$ = 1 Will an error result? A = no error
Slide 16 Naming Variables If you have any questions about assigning values to variables, please contact your instructor. Remember the TYPE of variable (string or numeric) must match the TYPE of value (alphanumeric or numeric). Also, choose a variable name that describes the value. Show Examples:
|