The Guide On Variables

This guide is about variables. It will teach you when to use them, how to use them, and why to use them. Pictures coming later!

What Are Variables And How Do You Make Them?

Variables are exclusive to block coding. They are located in the variables menu (obviously). When you first open that menu up, you don’t see any variables! Why is that? Well, you must first create a variable. To create a variable, click on the create a variable button, and type your variable’s name in. Now, the blocks for variables should appear. Now you are ready to use them.

How Do I Use Them?

So the set block, sets the variable to anything. The variable can store text, numbers, or true and false values (boolean values). When using more than one variable, there is a dropdown at the variable’s name, so you can pick your variable. Also, do not use get property with a variable! This will cause all sorts of problems!

The change by [insert number] block increases the variable by your specified number. Lastly, you have the individual variable. This is used when doing stuff (this can be literally anything!) with the variable, like energy*10. So now you know how to use variables!

When Do I Use Them?

Properties are variables’ main rivals. They are usually better than variables, however. Properties save outside of the specific time the block code runs, but variables don’t save in between 2 block codes running. This is HUGE. In regular old computations, variables would be better than they are now, but in games, we kind of need them to save outside of the block code. (This guide is sort of my anti-variable psa.) The main advantage of variables is that they don’t need a get property block to work, so whenever you use them, variables save a block. So, you should use variables whenever you have to use the same property 6 or more times (correct me if I’m wrong).

In conclusion, variables are pretty cool, but they are overshadowed by properties.

13 Likes

Ooo, this is neat!

Thanks!

nice guide!
i certainly agree that variables are tootally overshadowed by properties, because properties can be used the same way but can also be used outside of blocks.

6 Likes

Might wanna fix this, other than that, great guide!

2 Likes

Its right above the conclusion

Ok. I’ll do that! Thanks!

No problem, glad to help!

1 Like

Seriously, nobody’s made a guide on variables? Are you kidding me? Nice job, @getrithekd!

3 Likes

Trust me, when you are fighting the block code limit, variables can be a lifesaver.

Nice guide!

This guys is too good, someone needs to nerf him.

2 Likes

I’ve used variables to break up properties in the past.
set variable= remainder of property/1000,
set variable1= remainder of variable/100
set variable2= remainder of variable/10

2 Likes

They can be, but that situation almost NEVER occurs. I’ve never had to use variables, and I use block code regularly.

Yes, but my creations like my graphing calculator required so many more blocks than creative has space for, so most of the difficulty was fighting to get the block count down to 75.

2 Likes

This is my first time using variables:

5 Likes

In simpler terms, variables have a smaller scope than properties.

5 Likes

Variables = local properties!

I deleted my first time…it was basically a system for cash inside of blocks it was like the first time I tried GKC. I wanted the player to get cash and buy a gadget, but I didn’t know vending machines existed…

You could have a checker and item granters if you knew about them at the time