Search Header Logo
Variable Naming

Variable Naming

Assessment

Presentation

Computers

10th Grade

Practice Problem

Medium

Created by

Ryan Winton

Used 1+ times

FREE Resource

4 Slides • 5 Questions

1

Naming Variables

By Ryan Winton

2

media

Variables must have meaningful names.

Names that relate to the information/data they are storing.


A variable that stores the amount someone is paid per hour could be called payPerHour or pay_per_hour.

Meaningful
Variable Names

3

Naming Methods

Camel Casing

This name is given to the naming method where each new word in a variable name is given a capital letter (except the first word!).

payPerHour numberOfSubjects hoursWorked

Like a camel, these variable names have humps!

4

Naming Methods

Snake Casing

This name is given to the naming method where each new word in a variable name is separated by an underscore.

pay_per_hour number_of_subjects hours_worked

These variable names are like 1 long connected line like a snake!

5

Multiple Choice

Pick the example of Camel Casing

1

testScore

2

test_score

6

Multiple Choice

Pick the example of Snake Casing.

1

cube_volume

2

cubeVolume

7

Multiple Choice

Which of the following is not a suitable variable name?

1

test_score

2

TestScore

3

testScore

8

Multiple Choice

Which of the following is not a suitable variable name?

1

test_score

2

testscore

3

testScore

9

Open Ended

Give an example of a suitable name for a variable that is storing the number of subjects a pupil has taken.

Naming Variables

By Ryan Winton

Show answer

Auto Play

Slide 1 / 9

SLIDE