Scratch Notes - Variables

Intro, Commands, CT001, Draw a square, Draw a square cont., The Repeat Block, CT002, Fun with repeat, Variables, Using variables, Random numbers, Fun with random numbers, Challenge 001, Challenge 001 Help, Challenge 002, Challenge 002 Help, Challenge 003, Animate a GIF, Resources

 

The word variable means to change.

In Scratch each variable that you make has its own name.

Variables are used to remember numbers.

The name of the variable stays the same but the the number that it remembers can change.

 

 

 

This is what a variable called Sides looks like.

 

We can make Sides equal to 4

 

And we can use the variable Sides in our program.

 

This is how we make a Variable in Scratch

 

 

 

 

 

 

 

 

 

 

 

 

   This will draw a shape with 4 sides (a square)

 

 

 

 

This is the divided by block

 

So this means 360 divided by the number of sides   

If sides = 4 then 360 / 4 = 90

 

 

 

 

Once you have made a variable you can then give it a value (a number)

 

 

You can use the variable with as part of other blocks.

for example it could be the number of steps to take?

Or the number of sides for a polygon.

Try this:

 

See how to set the number of sides to 4 at the start of the program.

 

Now try this:

Previous step | Next page 006

 

web counter
web counter