Introduction
Bhailang is an open-source dynamically typed toy programming language written in Typescript. It has been trending all over Twitter and LinkedIn these days and has been the buzz of the Dev Community.
To install the library, use the command:
npm i -g bhailang
Creators and their Story
Bhailang is developed by Aniket Singh(SDE at Amazon, India) and Rishabh Tripathi(SDE at Groww, India). It can be accessed on this website and its source code may be accessed here.
According to them:
The actual Idea for "Bhailang" was originated from an internal joke a couple of years back when we had just started programming, since then, this idea was lurking around in the back of our heads.
Syntax
The Hindi word "bhai" means "brother". The entry point code for the language is hi bhai
and everything must end with bye bhai
. Everything written inside these tags is legitimate, but everything outside of them is ignored.
This will be ignored
hi bhai
// Write code here
bye bhai
This too
Declaring Variables
To declare variables in Bhailang, we use the phrase bhai ye hai
which means brother it is.
hi bhai
bhai ye hai a = 10;
bhai ye hai b = "two";
bhai ye hai c = 15;
bye bhai
Data Types
Numbers and strings are like other languages. Null values can be denoted using nalla
. sahi
and galat
are the boolean values for True and False respectively.
hi bhai
bhai ye hai a = 10;
bhai ye hai b = 10 + (15\*20);
bhai ye hai c = "two";
bhai ye hai d = 'ok';
bhai ye hai e = nalla;
bhai ye hai f = sahi;
bhai ye hai g = galat;
bye bhai
Print Statement
To print anything to console, we use bol bhai
which means say brother.
hi bhai
bol bhai "Hello World";
bhai ye hai a = 10;
{
bhai ye hai b = 20;
bol bhai a + b;
}
bye bhai
Output:
Shandaar bhai 🎉
> Hello World
> 30
Control Flow
Conditionals
Bhailang supports simple if-else construct, agar bhai
block will execute if condition is sahi
(true) and warna bhai
block will execute if condition is galat
(false).
hi bhai
bhai ye hai a = 10;
agar bhai (a < 25) {
bol bhai "a is less than 25";
} warna bhai {
bol bhai "a is greater than or equal to 25";
}
bye bhai
Output:
Shandaar bhai 🎉
> a is less than 25
Loops
Statements inside jab tak bhai
blocks are executed as long as a specified condition evaluates to sahi
. If the condition becomes galat
, statement within the loop stops executing, and control passes to the statement following the loop. Use bas kar bhai
to break the loop and agla dekh bhai
to continue within the loop.
hi bhai
bhai ye hai a = 0;
jab tak bhai (a < 10) {
a += 1;
agar bhai (a == 5) {
bol bhai "andar se bol bhai ", a;
agla dekh bhai;
}
agar bhai (a == 6) {
bas kar bhai;
}
bol bhai a;
}
bol bhai "done";
bye bhai
Output:
Shandaar bhai 🎉
> 1
> 2
> 3
> 4
> andar se bol bhai 5
> done
Code Playground
You can play around with this toy language on their official website here and have fun:https://bhailang.js.org/#playground
Community Support
People are actively contributing to the development of Bhailang(issues and PRs).
Not only this, companies such as Paytm and Razorpay have also recently tweeted about the language:
bhai bhai, output batao bhai... pic.twitter.com/gKEGPcJITN
— Paytm (@Paytm) March 15, 2022
Arre Bhai Bhai Bhai !!! pic.twitter.com/0dDC20tvD1
— Razorpay Engineering (@RazorpayEngg) March 14, 2022
Wrapping Up
People are having lots of fun with the language since its launch. They're even suggesting various funny Desi slangs for the programming language.
What do you think about this quirky new take on Javascript? Let me know in the comments below.
Note: The logo and codes are the sole trademarks of Bhailang and their developers.