Getting the User's Name and using Comments

In this video we ask the user their name, and store it in a variable. Think of a variable as a storage box for information.

keypoints

When you make a variable you need to

1. Give it a name (use camelCase)

2. Say what type of data your variable will contain: will it have a string (text), or an integer (whole number), a decimal number, or a boolean (true/false)?

3. Give it an initial (starting) value

 

We also look at Comments, which are important in keeping your code clear for yourself and others to read.

Activity - User's Name

Build your own animation that asks for the user's name and then uses it.

Don't forget to include comments in your code.

 

home   left arrow   right arrow