Skip to main content
Skip to content

Values keyword

sahi / galat — true / false

sahi (true) and galat (false) are AltFLang's two boolean values. Every comparison produces one of them.

Meaning: "right" and "wrong"

How sahi / galat works

Comparisons such as 5 > 3 or naam == "Asha" produce sahi or galat. Combine them with && (and), || (or) and ! (not).

Conditions also accept non-boolean values. These are falsy: galat, khali, 0 and the empty string "". Everything else is truthy — even an empty list.

prakar(sahi) returns sahi_galat, the type name for booleans.

Syntax

syntax
rakho flag = sahi;
rakho done = galat;

Runnable example

Expected output

Press Run to try it

Discount milega? sahigalat sahi_galatkhali string falsy hai

Same idea in JavaScript and Python

JavaScript
const umar = 22;
const student = true;
const discount = umar < 25 && student;
console.log("Discount milega?", discount);
Python
umar = 22
student = True
discount = umar < 25 and student
print("Discount milega?", discount)

Common mistakes

Putting sahi or galat in quotes

"galat" with quotes is text, and non-empty text is truthy — so the block runs. Write the keyword without quotes.

Galat
rakho ready = "galat";
agar (ready) { bol("chal pada!"); }
Sahi
rakho ready = galat;
agar (ready) { bol("chal pada!"); } warna { bol("abhi nahi"); }

sahi / galat: frequently asked questions

How do you write true and false in Hindi programming?

In AltFLang, true is sahi and false is galat. They are keywords, so write them without quotes.

Is 0 false in AltFLang?

Yes. 0, the empty string, khali and galat are all treated as false in a condition.