Skip to main content
Skip to content

Functions keyword

lautao — return

lautao ends the current function and hands a value back to the caller.

Meaning: "give back"

How lautao works

lautao value; returns that value. lautao; on its own returns khali. Reaching the end of a function without lautao also returns khali.

Because lautao exits at once, any code after it in the same function does not run. That makes early returns a clean way to handle special cases first, such as invalid input.

lautao only makes sense inside a karya body.

Syntax

syntax
lautao value;
lautao;

Runnable example

Expected output

Press Run to try it

0 100 50

Same idea in JavaScript and Python

JavaScript
function fee(umar) {
  if (umar < 5) return 0;
  if (umar >= 60) return 50;
  return 100;
}
Python
def fee(umar):
    if umar < 5:
        return 0
    if umar >= 60:
        return 50
    return 100

Common mistakes

Code after lautao

Lines after lautao in the same block never run. Move them above it.

Galat
karya f() {
  lautao 1;
  bol("yeh kabhi nahi chhapega");
}
Sahi
karya f() {
  bol("pehle yeh");
  lautao 1;
}
bol(f());

lautao: frequently asked questions

What does a function return if there is no lautao?

khali — AltFLang's null value.

Can lautao return several values?

Return a list or an object, for example lautao [min, max]; or lautao { min: a, max: b };