How jab_tak works
The keyword is one word joined by an underscore: jab_tak. The condition is checked first, so if it starts false the body never runs.
Something inside the loop must eventually make the condition false. If nothing does, AltFLang stops the program after a fixed step budget and reports a possible infinite loop instead of freezing your browser.
Use jab_tak when you do not know in advance how many rounds you need — reading input until it runs out, halving a number until it reaches 1, or retrying until a guess is right. For a fixed count, chalo is tidier.
Syntax
jab_tak (condition) {
// body
}Runnable example
Same idea in JavaScript and Python
let n = 100;
let steps = 0;
while (n > 1) {
n = Math.floor(n / 2);
steps = steps + 1;
}n = 100
steps = 0
while n > 1:
n = n // 2
steps = steps + 1Common mistakes
Forgetting to update the counter
Without i = i + 1 the condition never changes, so the loop runs until the step limit stops it.
rakho i = 0;
jab_tak (i < 3) {
bol(i);
}rakho i = 0;
jab_tak (i < 3) {
bol(i);
i = i + 1;
}Writing jab tak as two words
jab tak with a space is two unknown names. The keyword is jab_tak.
jab tak (x < 5) { }rakho x = 0;
jab_tak (x < 5) { x = x + 1; }
bol(x);jab_tak: frequently asked questions
What is the while loop in Hindi programming?
In AltFLang it is jab_tak, meaning "as long as". jab_tak (condition) { ... } repeats the block while the condition is truthy.
Is there a do-while loop?
No. To run the body at least once, set the condition variable so it starts true, or write the body once before the loop.