This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-05-12 15:34:13

Mandy23
Scratcher
Registered: 2009-01-08
Posts: 2

How Do I Use A Variable? and What Is A Variable?

I've heard many thing on 'Variables', and I've never understood what they were exactly. I've read another forum that used a Variable, but I couldn't do it. I followed the directions and everything and I just never understood. So I'm asking, what IS  a variable and how do I use one?

Offline

 

#2 2009-05-12 17:09:37

bhz
Scratcher
Registered: 2008-07-06
Posts: 100+

Re: How Do I Use A Variable? and What Is A Variable?

http://scratch.mit.edu/forums/viewtopic.php?id=1346

Offline

 

#3 2009-05-13 13:13:56

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: How Do I Use A Variable? and What Is A Variable?

basicly, a variable holds any value (usually numeric). This value can be changed, and accessed easily. For example, if i had a variable called myVariable, and i gave it a value of 1. if I then ask a sprite to say the variable, it will simply say one. variables are often used with gravity. So lets called our gravity variable grav. if i say:
forever
change [grav] by 1
change y position by [grav]

it will give it the illusion of acceleration (remember to set grav back to 0 though if you want to stop accelerating)

Offline

 

Board footer