CRCD.T1.M1.07: Parameters

Using the Grid Part 2

How do we increase width and height on the grid?

In this lesson, we are going to explore PARAMETERS, which are extra pieces of information, like width and height, that are assigned to a function (in this case, to an object on the grid.)

     Parameters = properties assigned to a function (our object on the Grid)

     Parameters.PNG

     Parameters here:  color, x position, y position, width, height 

Parameters

A parameter is an "extra" piece of information about something.  For instance, you may be a human, but there are other parameters that describe you:  your height, your hair color, your eye color, etc.

 

Randomization

What if we want our code to change each time we run it?  The solution to this is to use random numbers.  This code chooses a random number between a minimum and maximum value. For instance, if you want your drawing to change sizes, you might set its height to be a random number between 1 and 100.  If you make your drawings with random numbers it will look a little bit different every time you run your program.

Vocabulary

  • Parameter - An extra piece of information passed to a function to customize it for a specific need

 

New Code

 

Note: Most Instructional content is taken from the Code.org Curriculum in CS Discoveries 2021-2022 Links to an external site.