How rakho works
Write rakho, a name, = and a value. The name must start with a letter or underscore and may contain letters, digits and underscores. Leave the value out (rakho jawab;) and the variable starts as khali.
Variables are block-scoped: one created inside { } disappears when the block ends, while code inside a block can still read and update variables declared outside it. A variable can hold any type and may switch type later.
Use rakho once per name per block. After that, update the value with naam = naya_value;.
Syntax
rakho naam = value;
rakho khaali_variable;Runnable example
Same idea in JavaScript and Python
let shehar = "Jaipur";
let log = 30;
console.log(shehar, "mein", log, "lakh log rehte hain");
log = log + 1;shehar = "Jaipur"
log = 30
print(shehar, "mein", log, "lakh log rehte hain")
log = log + 1Common mistakes
Declaring the same name twice
A second rakho for a name that already exists in the same block stops the program with an "already declared" error. Drop rakho when you only want to change the value.
rakho score = 10;
rakho score = 20;rakho score = 10;
score = 20;
bol(score);Assigning before declaring
total = 5; without an earlier rakho total is an error, because there is no box called total yet. Declare it first.
total = 5;rakho total = 5;
bol(total);rakho: frequently asked questions
Is rakho like let or var in JavaScript?
It behaves like let: the variable belongs to the block it was declared in, and it can be reassigned. Declaring the same name twice in one block is an error.
Can a rakho variable change its type?
Yes. AltFLang is dynamically typed, so a variable that held a number can later hold text, a list or khali. Use prakar() to check what it holds right now.