← Lessons CP 🏭 Function Factory ● ○ ○ ○
🏭 Robot Factory — Functions are like custom machines in a factory! You build a machine once (a function), give it a name, and then use it whenever you need it. No more repeating the same code over and over!

🧩 What's a Function?

A function is a reusable block of code with a name. Think of it as your own custom action button! You define a function once (build the machine), then call it anytime (press the button). In JavaScript: function greet() { ... } defines it, and greet() calls it. Functions can have parameters too — inputs that change how they work! 🏭 Remember: In Loop Master you used loops to repeat actions. Functions let you save a whole set of actions and run them with ONE command!

🎯 Today's Missions Call a function! Use 3+ unique functions! Complete all 4 challenges!

🏭 Function Builder

Name → Pick actions → Call your function!

🤖
Last called:
🏷️ Name Call it anything!
🎬 Actions Tap to add →
Body: (click actions above to add)
📦 Presets Ready-made!
Functions called: 0
📄 Live Code View
// Your function will appear here
function greet() {
  // add actions above!
}

// Call it:
greet();

🎯 Function Challenges

1
Create a function called waveGreeting with at least 2 Wave actions, then call it!
2
Build a function with 3 different actions (e.g. Jump + Spin + Glow) and call it
3
Use the danceParty preset — call a function someone else already built!
4
Your turn! Create and call 3 different functions — change the name AND actions each time
🌟 Mastery progress0%

🏭 Function Factory

Welcome to the Robot Factory! Today you'll learn about functions — one of the most powerful tools in coding. A function is like building a custom machine. You build it once, give it a name, and use it whenever you need!

🏷️Give your function a name (like waveGreeting)
🎬Add actions to your function — Wave, Spin, Jump, Glow, or Melt
▶️Press Call Function to run ALL the actions at once!
📦Try the Presets — ready-made functions. That's code reuse! 🎉