Gray blocks ? and Null


I know sooner or later our students are going to ask what the gray blocks mean in MakeCode Arcade. I’d kind of like to have an answer for them that they can understand. I have gone into JavaScript and tried to change the word “null” to 0 or to zero and just get an error. So I don’t know what null means either. Since these gray blocks are not in the tool box it’s kind of hard to tell what they mean. I’m not sure if I delete them from the program if the game will still work . It does upload and play on BrainPad Arcade console. Any suggestions? And is there kind of a glossary page describing all this for noobs? Thx.


Gray blocks are known as JavaScript blocks:

When you switch from Blocks mode to JavaScript mode and then back to Blocks mode, any JavaScript code that cannot be translated to a block is rendered instead in a JavaScript block.

The reason that your students are seeing JavaScript blocks is because the translation from Blocks to JavaScript and then back to Blocks is not yet perfect. That’s where you are getting the null blocks. Those can safely be deleted in Blocks mode.


In addition to what Alex said;

In this case, those are just extra variable declarations that can be removed without changing anything. They are only showing up because the script is a bit older and we made some changes to allow for smarter variable declarations when converting from blocks -> JavaScript (in this case, not making global variables for event parameters, so that the variables can’t be used in places they aren’t actually available).

And as a side note, as of the current beta release (v0.11.11), I’m not aware of anything that is made in blocks and fails to go from blocks -> JavaScript -> blocks in a valid form (that is less than 1500 blocks); if you have something made in blocks from that release onwards that creates gray blocks, or otherwise fails to decompile to blocks, we’d love to see it so we can fix it!

1 Like