What are variables exactly? And what can you do with them?

variables

#1

My question is in the title: What are variables, and what can you do with them in projects? Just asking.

I’m a new Hopscotch and forum user, so I was wondering :confused:


#2

Variables are numbers that you can set, and then access later on in your project. For example if you are making a game, you may want to keep track of the score. To do this, you create a new variable called Score.

To display your variable, you can use the Set Text to Score block. Here’s a tip: put the block in a Repeat Forever block so that the text object always displays the score.

If you want to set your variable to a number, (for example, you might want someone to start with 100 Coins in a game) use the Set block.

If you want to increase your variable (for example when a player scores a point), use the Increase block. You can increase the variable by whatever value you like, and also decrease it by using negative numbers.

You can access your variables in any block that takes a number by scrolling left on the keyboard, until you see the variables. Tap on a variable to add it to your code.

If you have any other questions, just tag me @MR.GAM3R. Hope this helps!


#3

Oh, that is cool, thank you

@admins is that the right tag? i was guessing since i’m new to hopscotch and hopscotch forum, if it’s right then please close this topic as i have my colution


#4

Welcome to the forum!
If you need my help type @Fluffymice and I’ll help you.

How to make a poll

Type EXACLY this
[poll]
- (optinal)
- (text)

[/poll]

Remember the - for each line!

How to make Aqua text

Type this: <a> This will turn out Aqua </a>

How to make Crossed out text

Do this: <s> this will be crossed out </s>

How to make invisible text

Invisible text cannot be seen by anyone. Why would you need it? Because sometimes you have to type in 20 charecters. So you can use this trick <this will be invisible>

How to make blurry text

To make this you do: [s<hh>poiler] anything here [/spoiler]

how to make a button

to do this, You type
<kbd> Hello! </kbd>

And you dont need to close this topic. I like your profile pic!


#5

No problem! I don’t think the @admins tag actually notifies the admins, you will need to tag the individual people.


#6

It does tag them. Click on it. Its a group


#7

Variables are something that is very important in all programming.

They are numbers that can be changed whilst playing the project.

Also, your name seems familiar… I think I’ve seen you on Hopscotch.

Also, next time you make a topic, please search for topics like it.


#8

@trust_level_3 doesn’t do anything last I knew, and that’s a group. Same goes with @admins I think. LGBOT though


#9

Once you learn how to use variables it brings you into a new world of coding I use them it almost all of my projects


#10

@mieli

You may also find this explanation of self variables that I posted a while back helpful:
http://forum.gethopscotch.com/t/what-exactly-does-self-do-any-examples/30900/5?u=thinbuffalo


#11

I dont have an Hopscotch account yet…

what acc do i remind you of?


#13

I think its a coincidence


#14

I love ciphers though


#15

That’s an extremely big coincidence
I’ll stop bugging you now

but I still think you’re HappyDolphin


#16

I don’t know.


#17

Welcome to Hopscotch and to the Forum!

Other people above have really explained Variables in a super good way, so you should check their posts!

If you want your topic closed, the admins can help you. @t1_hopscotch is our most active admin, and she is one of the people that can close your topic if you want.