GKC Block Code Compared to Written Code Examples

Hello!
Recently I noticed that while many people are familiar with block code, there could be a small group of people who aren’t and are instead more used to written text code. so I decided to compare block code blocks and written code functions to help that group of people understand GKC’s block code (if this isn’t allowed please let me know as I’m having trouble understanding if it is or isn’t myself)


Check if editing. Don’t check for fun. Ask before editing.
Also, you can edit the table directly which is a lot easier! Click the pencil icon to the right of it to open the table interface!


Block Code and Written Code Comparisons.

GKC Block Code Python Javascript
Add item () to activity feed print() console.log("text")
Broadcast Message on Channel () NameHere(): function nameHere() {}
Set Variable to () local variable = () let nameHere = "text" // text string let numberHere = 7 //number
Set Property () Value () global variable = () let numberHere = 7 //declare outside of block to be globally scoped
if () do if (): if () { }
create text with () and () variable = "String 1" + "String 2" concat(string1, string2, ... StringX)
Random Integer from [low] to [high] import random(new line) random.randint(num1, num2) random(low, high)
GML (Gamemaker Language) C++ What they do
show_debug_message("Message Here"); Show text strings in a console like area
show_debug_message("Message Here"); Broadcasts for a user made action to be done
var _name ="text" | var _name = 231 Sets a variable only accessible by this one script or function.
global.name = "text" | global.name = 312 Sets a variable that is accessible anywhere
if ( expression ) { script } Check if a value or equation is true and if it is do an action.
name = "text" + "text" makes a new string value with 2 or more existing string values
irandom_range(min, max) Gets a random integer between do given integers.

of course more will be added later, these are just the first ones I thought of.
(feel free to tell me if this belongs in Community Made Guides or Devices)

Contributors

Fleet
Turtle
Bardy :D
Toxic
recalledMemories

17 Likes

Can I add Javascript please?

That’s fine, it’s a wiki for a reason!

3 Likes

sure, I don’t know java script unfortunately so I couldn’t do it myself.

1 Like

I’d think Devices.
This is part of GKC but also is advanced.


But code does say it contains code so maybe not?

2 Likes

Okay I added the Javascript, a check box and explanation, some formatting, and a contributors section. I can remove the other stuff if you want, just thought it’d be helpful.

2 Likes

Can I add GML? I won’t be able to until Monday though

1 Like

i think teh python and the javascript got mixed i know my java i use p.5 js and just proccesenig js and print is in java why isnt it in java section

1 Like

No, print(“sigma”) would output, “sigma” in Python.
print() is totally different in Javascript.
Fleet, can I add more to the Python section?

oh yeah cus in java its for data

1 Like

also sorry im not an expert i meani can make a platformer but im not like expert

1 Like

(literally anyone can make a platformer : | )

If you can’t help then don’t help.

4 Likes

I thought python functions were like def name {} or something like that.

1 Like

You mean:
def sigma():

print(“sigma”)

Then:
sigma()
the output would be:

sigma

I don’t think you can put custom blocks in Gimkit, though.

I believe you added this and I think that using the concat() function would be better for this. Here’s a link explaining: JavaScript String concat() Method.

2 Likes

Yeah I put that in the guide.

1 Like

Oops, sorry! You can add that if you want.

1 Like

Sure! go ahead (sorry for the late reply :sob: )

1 Like

yeah, what I’m saying is you can use channels to brodcast for an action that you chose for the game to do when recieving on that channel (that’s how I’m comparing functions and channels)

Sure thing (again sorry for the late replies, I’m just generally not active during the weekends)

1 Like

huh, maybe I was confusing them with Lua (my bad, I use Lua on a daliy its bound to happen some where)

1 Like