Discuss Scratch

Barle
New Scratcher
1 post

Variables? And How to use them/understanding them..

Okay so i am in a programming class and for our first super simple language he has left us to explore and start to understand programming with scratch. I seem to understand it fairly well.. But i do not understand how to use variables at all.. Could someone please help me to understand them or send me a link to help me understand them. I have my programming class next so i also play on asking my teacher.
drmcw
Scratcher
1000+ posts

Variables? And How to use them/understanding them..

A computer program is a combination of data and code, you cannot have one without the other. A variable is simply a way to store data and give it a meaningful name. You are already using Scratch's built in variables when you move a sprite by changing the x and y position variables. Since scratch doesn't know what we want to store it allows us to create our own variables, so if you have a game and need to have 3 lives, you need a variable
setlivesto3

when you lose a life
changelivesby-1
until
iflives=0thensayGame Over!

Last edited by drmcw (Feb. 26, 2014 21:00:15)

mathfreak231
Scratcher
1000+ posts

Variables? And How to use them/understanding them..

Variable

that should help…

Powered by DjangoBB