Skip to main content
Skip to content

Lesson 1 of 12

Namaste Duniya: your first AltFLang program

Print text with bol, leave notes with comments and run your very first Hinglish program — no install, no setup.

5 min

What you are about to do

Every programmer's journey starts with one line that prints something on the screen. In AltFLang that line uses bol — literally "say". You tell the computer what to say, it says it in the output panel.

AltFLang runs entirely in your browser. A small lexer reads your text, a parser turns it into a tree, and an interpreter walks that tree. Nothing is sent to a server, so you can press Run as many times as you like.

Your first line

Type text between double quotes and give it to bol. The quotes tell AltFLang that this is a string — plain text — and not the name of something. A semicolon ; ends the statement. AltFLang will usually forgive a missing semicolon, but writing it keeps your code clear.

Expected output

Press Run to try it

Namaste Duniya!

Printing more than one thing

Give bol several values separated by commas and it prints them on one line with a single space between each. Numbers do not need quotes. chhap ("print") does exactly the same job — use whichever word you like.

Each call to bol prints a new line. You can also write bol without brackets, as in bol "Hi"; — but the bracket style is easier to read once lines get longer.

Expected output

Press Run to try it

Mera naam Asha haiMeri umar 21 saal haichhap bhi bilkul bol jaisa hai

Comments: notes for humans

Anything after // or # on a line is a comment. The interpreter skips it completely. For longer notes, wrap text in /* and */. Use comments to explain why your code does something — your future self will thank you.

Strings can use double quotes, single quotes or backticks. Inside a string, \n starts a new line and \t adds a tab.

Expected output

Press Run to try it

Single quotes bhi chalte hainPehli line
Doosri line

Practice exercise

Print exactly two lines: first Namaste Duniya, then Main AltFLang seekh raha hoon.

Expected output

Namaste Duniya
Main AltFLang seekh raha hoon
Open in playground
Show solution
solution.altf
bol("Namaste Duniya");
bol("Main AltFLang seekh raha hoon");