Function
beginnerDefinition
A reusable block of code that performs a specific task. You give it a name, and whenever you need that task done, you 'call' the function by name instead of writing the same code again. Functions can accept inputs and produce outputs.
In the wild
function greet(name) { return 'Hello, ' + name; } defines a function called 'greet'. Calling greet('Alice') runs that block and gives back 'Hello, Alice'. You can call it as many times as you want with different names.
More from Programming Basics
Parameter
A variable listed in a function's definition that acts as a placeholder for data the function will receive when it's called. Parameters let you write one function that works with many different inputs instead of hard-coding specific values.
Return Value
The output a function sends back to the code that called it. When a function reaches a 'return' statement, it stops running and hands back that value. The calling code can then store it in a variable, display it, or pass it to another function.
Variable
A named container that holds a value in your program. Think of it like a labeled box: the label is the variable's name, and inside is the data (a number, some text, a list, etc.). You can read what's inside, replace it, or use it in calculations.