PDA

View Full Version : Assignment 5


Mauricio
10-04-2016, 12:03 PM
Even though assignment five is about decision making, it actually helped to clarify more about variables, what they are and how to store them. I understand what a variable is but I was still somewhat confused about how it got its value after you set up the variable, although in this case the variable seem more like a constant because the exact number you had to enter in order for the bouncer to let you in was twenty-one, but I get it now, you create the variable and the value is assigned to that variable when the user enters a number. Making decisions with the If/Else statements will help to cut down on the amount of code that would be required otherwise. This will also be of helpful if you have to make changes to a program by making it easier to read through the code and be able to find any issues faster.

lucyrn99
10-05-2016, 11:28 AM
Hi Mauricio,

I'm glad to hear that as we get more experience with different parts of the Alice program, it's making more sense to you. I feel the same way - the concept of parameters and variables are a little fuzzy, until you experiment with them in your own animations.

Regarding your question of how the variable got its value, I think of it this way:
when you create a new variable, you pick any value (for Assignment 5, it was a numerical value) as a placeholder.
The value you replace the placeholder with, is created by the 'what is your age' question that you ask the user.
Whatever answer your user gives when they are asked the question, that numerical answer then becomes the value in the variable.

Hope the above makes sense! Stick with it, we're all in this together and the concepts will start making sense the more practice we get. :)