Skip to content

Return Value

Easy — everyone uses thisGeneral Dev

ELI5 — The Vibe Check

A return value is what a function hands back to you after doing its work. You send a coffee machine beans and water, it returns coffee. If a function returns nothing, it just does a task and walks away without giving you anything.

Real Talk

A return value is the output that a function sends back to its caller via the return statement. The caller can store it in a variable or use it directly. A function with no return value has a void or None return type.

Show Me The Code

function add(a: number, b: number): number {
  return a + b; // this is the return value
}

const sum = add(3, 4); // sum === 7

When You'll Hear This

"Capture the return value and log it." / "The function has no return value — it just mutates state."

Made with passive-aggressive love by manoga.digital. Powered by Claude.