Skip to main content
Skip to content

Values keyword

khali — null / None

khali means "no value". It is falsy, and it shows up whenever something was asked for that does not exist.

Meaning: "empty"

How khali works

You get khali from a variable declared without a value, a list index past the end, an object field that was never set, a function that does not lautao anything, and pucho() once the input has run out.

Check for it with == khali or != khali. Because it is falsy, agar (value) also skips it — but remember that 0 and "" are falsy too.

prakar(khali) returns khali.

Syntax

syntax
rakho x = khali;
agar (x == khali) { ... }

Runnable example

Expected output

Press Run to try it

khaliEmail abhi set nahi haikhali khali

Same idea in JavaScript and Python

JavaScript
const user = { naam: "Sam" };
console.log(user.email); // undefined
if (user.email == null) console.log("Email abhi set nahi hai");
Python
user = {"naam": "Sam"}
print(user.get("email"))  # None
if user.get("email") is None:
    print("Email abhi set nahi hai")

Common mistakes

Writing "khali" as text

"khali" in quotes is just a five-letter string and is never equal to the real khali value.

Galat
agar (user.email == "khali") { }
Sahi
rakho user = {};
agar (user.email == khali) { bol("missing"); }

khali: frequently asked questions

What is null in AltFLang?

khali. It represents a missing or empty value and is treated as false in conditions.

Does reading a missing list index crash the program?

No. Reading a position that does not exist gives khali, so check the index against lambai(list) when it matters.