Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do you Code With Variables?
- Cosmoportal
-
Scratcher
17 posts
How do you Code With Variables?
set [ v] to [How do you make and use variables? I need to know so I can code games. I just know how to use it.]
[scratchblocks]
when green flag clicked
[/scratchblocks][scratchblocks]
forever
play sound [ Help me!] until done
[/scratchblocks]
[scratchblocks]
end
[/scratchblocks][scratchblocks]
ask [Can you help me PLEASE?] and wait
<[☁ score] contains [thing] ?>
Last edited by Cosmoportal (Jan. 27, 2021 12:32:46)
- s176728
-
Scratcher
41 posts
How do you Code With Variables?
You can make a vairable like “Score” To keep score. You can just make a new variable
- _THEBOSS_7
-
Scratcher
500+ posts
How do you Code With Variables?
uhhhh you set var. to numbers you want, to store data, but use lists if you want to store lots of data. var. can also store letters and symbols but cloud variables cannot.
- cclevenger
-
Scratcher
13 posts
How do you Code With Variables?
So a variable saves string and number data, or information. When you set the variable “score” to 7, scratch remembers that number.
Say you want to add “score” to 5. You will say, “set <new variable> to ”score“ + 5”. That will make new variable equal 12, because 7+5 is 12.
This is good for clicker games:
When this sprite is clicked:
change “score” by 1
I hope this helps!!!
Say you want to add “score” to 5. You will say, “set <new variable> to ”score“ + 5”. That will make new variable equal 12, because 7+5 is 12.
This is good for clicker games:
When this sprite is clicked:
change “score” by 1
I hope this helps!!!
- Discussion Forums
- » Help with Scripts
-
» How do you Code With Variables?