agar: run code only if
agar means "if". Put a condition in brackets, then a block in curly braces. The block runs only when the condition is truthy. The braces are required, even for a single line.
warna: otherwise
warna means "otherwise". It follows the closing brace of an agar and runs when the condition was false. Exactly one of the two blocks runs, never both.
warna agar: more than two choices
Chain checks with warna agar. AltFLang tests them top to bottom and runs the first block whose condition is true, then skips the rest. A final warna catches everything that matched nothing. Order matters: put the strictest check first, otherwise a broad check like marks >= 33 would swallow a 95.
Conditions inside conditions
A block can contain another agar. That is called nesting. Often && reads better than two nested levels, but nesting is useful when the inner check only makes sense after the outer one passed.
Practice exercise
Given temp = 38, print Garmi if temp is above 35, Mausam badhiya if it is from 20 to 35, and Thand otherwise. Then change nothing else — the expected output is Garmi.
Expected output
Garmi
Show solution
rakho temp = 38;
agar (temp > 35) {
bol("Garmi");
} warna agar (temp >= 20) {
bol("Mausam badhiya");
} warna {
bol("Thand");
}