Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Scratchblocks Syntax: A Simple Guide
- PowPro1502
-
Scratcher
100+ posts
Scratchblocks Syntax: A Simple Guide
The scratchblocks feature is present in the forums and allows for Scratch blocks to be visualized as code in posts, allowing for more clear and concise explanations of code. This is a simple guide for how to render these blocks correctly.
1. Undefined scripts
Scripts with no definitions are rendered as pure red, showing that they are undefined and have no pre-coded actions. To create custom blocks see section 2.
For example,
2. Custom blocks
You were probably wondering how to make custom blocks. To make a block, type “define” then your custom block's name. For example, define Hello World gives:
It's the same with booleans but use <> instead. If <thing> then set variable to (input) and underneath an if <thing> set variable to (input) gives:
Then you can use that custom block in the same post
“If <thing> then set variable to (input) :: custom blocks” gives:
1. Undefined scripts
Scripts with no definitions are rendered as pure red, showing that they are undefined and have no pre-coded actions. To create custom blocks see section 2.
For example,
This script is undefined
2. Custom blocks
You were probably wondering how to make custom blocks. To make a block, type “define” then your custom block's name. For example, define Hello World gives:
define Hello WorldAnd if you wish to add an input, just add an () containing the input name, and include that in the block below the define. For example define Move (steps) then a move (steps) steps within the same scratchblocks chunk gives:
define Move (steps)
move (steps) steps
It's the same with booleans but use <> instead. If <thing> then set variable to (input) and underneath an if <thing> set variable to (input) gives:
define If <thing> then set variable to (input)
if <thing> then
set [my variable v] to (input)
end
Then you can use that custom block in the same post
“If <thing> then set variable to (input) :: custom blocks” gives:
If <> then set variable to () :: custom blocks
- LittleGreyCells
-
Scratch Team
1000+ posts
Scratchblocks Syntax: A Simple Guide
Hello! It's great that you want to help out other Scratchers. However, I think we have enough guides in the forums at the moment. Please feel free to welcome new Scratchers on the group welcoming topic or on individual topics created by New Scratchers.
Other places that can always use more helpful Scratchers like you, are the “”Help With Scripts“” and “”Questions About Scratch“” areas - please use them as designed, by responding to topics created by folks with problems to solve
Finally, a really good place for Scratch guides is the Scratch Wiki - check it out and see if it's something you might like to work on. They have a number of guides - and great organization.
Other places that can always use more helpful Scratchers like you, are the “”Help With Scripts“” and “”Questions About Scratch“” areas - please use them as designed, by responding to topics created by folks with problems to solve

Finally, a really good place for Scratch guides is the Scratch Wiki - check it out and see if it's something you might like to work on. They have a number of guides - and great organization.
- Discussion Forums
- » Help with Scripts
-
» Scratchblocks Syntax: A Simple Guide