Printing Hello World
Learn how to write, run, and understand your first BornomalaScript program with `lekho`.
Hello World
Your first BornomalaScript program should do one simple thing: print text to the console. That may look small, but it is the first proof that your compiler, editor, and terminal are all working together.
In BornomalaScript, the lekho command is used to display output.
If this lesson works on your machine, it means your setup is ready for the next topics in the basics section.
Basic Example
To print a message in BornomalaScript, use lekho:
lekho("Hello World!")
When the program runs, it sends the text to the console output window.
This is the smallest useful program in the language because it shows a complete loop from source code to terminal output.
If you are just getting started, this example is important because it introduces the most basic programming workflow:
- Write code in a
.bsfile - Save the file
- Run it with the compiler
- Read the output in the terminal
Step-by-Step Walkthrough
If you want to follow the lesson slowly, do it in this order:
- Open your editor or VS Code
- Create a new file named
hello.bs - Type the
lekho("Hello World!")line - Save the file
- Open a terminal in the same folder
- Run
bs run hello.bs - Look for the output in the terminal
If you see Hello World!, your first BornomalaScript program is working.
How It Works
The lekho function takes a value and prints it as output. In this case, the value is the text Hello World!.
That means:
lekhois the output command"Hello World!"is the string being printed- The terminal is where the result appears
This first example helps you understand the connection between source code and output.
You do not need any extra variables, loops, or conditions yet. The goal here is only to learn the simplest possible command that creates visible output.
Why the Quotes Matter
The quotation marks around Hello World! tell BornomalaScript that this is text.
If you remove the quotes, the compiler may treat the value differently or show an error.
For example:
lekho(Hello World!)
That version is not correct because the text is no longer marked as a string.
Running the Program
After installing the compiler, create a file named hello.bs, paste the code into it, and save it in your project folder.
Then run it from the terminal:
bs run hello.bs
If the command succeeds, you should see:
Hello World!
If you want to practice more carefully, run the command again after changing the text in the file. That helps you see the connection between editing the source and changing the output.
Running the Program
After installing the compiler, create a file named hello.bs, paste the code into it, and save it in your project folder.
Then run it from the terminal:
bs run hello.bs
If the command succeeds, you should see:
Hello World!
Expected Result
The terminal should display the exact text you wrote inside the quotes.
That means the program does not need to return a value or ask for input. Its only purpose is to show that BornomalaScript can print output correctly.
Try These Variations
Once the basic example works, try changing the printed message:
lekho("Shagotom BornomalaScript!")
lekho("Ami BornomalaScript shikchi")
lekho("Bangla syntax diye coding shikha shuru hok")
lekho("My first BornomalaScript program is working")
These small changes help you confirm that the compiler is reading your file correctly and printing exactly what you wrote.
What You Should Check
If nothing appears in the terminal, check the following first:
- The file was saved correctly
- The file extension is
.bs - The compiler is installed and available in PATH
- You ran the command from the correct folder
- The file name in the command matches the file on disk
If you see an error instead of the output, read it carefully. Beginner errors are often caused by a missing file name, a wrong folder, or a typo in the code.
Also make sure you are not accidentally editing a different file with the same name in another folder.
Common Beginner Questions
Do I need to use VS Code?
No. You can use any text editor, but VS Code is helpful because it makes .bs files easier to manage and read.
Do I need to know variables first?
No. Hello World is often the first lesson because it teaches output before introducing storage, input, or control flow.
Can I change the message?
Yes. In fact, you should change the message a few times so you get used to editing and running the same file repeatedly.
What if I only see the code and not the output?
That usually means the program did not run successfully, the file was not saved, or the terminal is pointing to the wrong folder.
Try These Variations
Once the basic example works, try changing the printed message:
lekho("Shagotom BornomalaScript!")
lekho("Ami BornomalaScript shikchi")
lekho("Bangla syntax diye coding shikha shuru hok")
These small changes help you confirm that the compiler is reading your file correctly and printing exactly what you wrote.
Mini Challenge
Create three separate hello.bs-style files and print a different message in each one:
- A greeting in English
- A greeting in Bangla
- Your name and favorite subject
This simple exercise helps you practice saving files, running commands, and checking output without needing any new syntax.
Why This Example Matters
The Hello World program is a standard first lesson in programming because it verifies the most important parts of the environment:
- The compiler is installed correctly
- The terminal can execute BornomalaScript commands
- The editor can save the file in the correct format
- The language can display output successfully
Once this works, you are ready to move on to variables, input and output, and basic program structure.
It also gives you confidence. A working first program removes a lot of uncertainty before you learn more advanced topics.
Common Mistakes
Beginners often make a few small mistakes when writing their first program:
- Forgetting quotation marks around text
- Typing the wrong file name in the run command
- Saving the file with the wrong extension
- Running the command from the wrong directory
- Mixing up
lekhowith another language's print function
If your code does not run, fix one issue at a time and test again.
If you are still stuck, compare your file against the exact example on this page and make sure every character matches.
Quick Checklist
Before moving on, confirm these points:
- You created a file named
hello.bs - The file contains
lekho("Hello World!") - The file was saved before running the command
- You ran
bs run hello.bsin the correct folder - The terminal printed the expected text
If all five are true, your first BornomalaScript program is complete.
Practice Task
Try writing these programs on your own:
- Print your name
- Print your school or college name
- Print a short Bangla greeting
- Print two separate lines of text in two different files
Example:
lekho("Amar nam Mahfuz")
lekho("Ami BornomalaScript shikchi")
Try writing one message in Bangla and one in English so you can see how comfortably the language handles both.
Next Step
After Hello World, the best next lesson is variables. Variables let you store values and reuse them in your programs.
Continue to the next basics lesson once this example works in your terminal.
Summary
Hello World is small, but it teaches the full beginner workflow: create a file, write code, save it, run it, and read the result.
Once you can do that, you are ready to learn how BornomalaScript handles values, names, and more interesting programs.