Blocks Area

Functions

🔧 Functions – Your “Time-Saving Superblocks”.

What it is: Blocks that group several instructions into one.

What it does: Create your own code blocks.

Example: Create a function called “blinkLED” that turns the LED on and off.

👉 They are like shortcuts or “superblocks” that save time.

 

🧩 Fun Guide to Functions Blocks (Clu-blocks Pro)

🧠 Important! Function blocks let you create your own mini-programs that you can reuse anytime. Think of them like custom spells or super tools — you build them once, and then call them whenever you need them!

#BlockWhat it doesDropdown optionsWhat the options mean
1procedure (with gear icon)Creates a custom functionYou name it, add inputs, and build what it does — like designing your own robot move
2procedure with returnCreates a function that gives back a resultYou can use this to calculate something and return the answer (like math or sensor checks)
3returnSends a value back from a functionMust be placed inside a function — it’s like saying “here’s the result!”
4if ... returnReturns a value only if a condition is trueGreat for smart decisions — like “if button is pressed, return ‘go’”
5procedure with: xDefines a function with an input called xYou can pass values into your function — like giving it a number or a name to work with
6inputs with: xSets up the input for your functionYou decide what kind of info your function needs — like a speed or direction
7with: yAnother input block for functionsYou can add multiple inputs — like x and y for coordinates or options
8allow statements (checkbox)Lets you add actions inside the functionIf checked, you can put loops, conditions, and other blocks inside your function

🧠 Quick Tips for Students

  • Use functions to organize your code — no need to repeat the same blocks over and over!
  • Use inputs to make your functions flexible — like changing speed or color.
  • Use return when you want your function to give back a result — like a score or sensor value.
  • Always build your function first, then call it when you need it — like pressing a button to activate a move.
On this page