Lesson 2

Establishing Variables

To create out virtual pet, we will need to first set up several variables for the pet.

The first variable will be the name of the pet. On line 2 add the following code petName = “Newton” . You can put whatever you want instead of Newton

On lines 3, 4 and 5, we will be setting up three additional variables:Hunger, Happiness, and Energy. All of these variables will be equal to 100. Copy the code you see in the image to the side

On line 6, add action=”0″

variable “action” to keep track of our input, and set it to 0 to start with. Tell students this is how we will select what we want to do with our pet