3. Download vs code and node.js.
4. Install bhaiLang package and also install bhaiLang extenstion for syntax highlight.
5. Example - 1 Print Hello World.
6. Example - 2 Find positive and negative number.
7. Example - 3 Print 1 to 5 using loop.
BhaiLang - new programming language :
A new programming language called "Bhai Lang" has been created by two indian developers named Aniket singh from Amazon and Rishabh Tripathi from Groww. The toy programming language which was inspired by the "bro talk" used by hindi speaking public has inspired netizens all over the world.
"Bhai" is known as brother in hindi and the programming language consists of a typescript which is combination of different hindi words and hi,bye amoung others.
Syntax :
- Enter point : A program must begin with a hi bhai.
- Exit point : A program must end with a bye bhai.
- Printing Statement : bol bhai "Welcome to getsolutionhub";
- Variable declaration :
- Integer : bhai ye hai a=5;
- Float : bhai ye hai a=5.4;
- char : bhai ye hai name="ram";
- String : bhai ye hai ch='g';
- Null values are indicated with nalla. and Sahi and Galat represent boolean values.
- Condition Statment like if else : Here instead of if code agar bhai(condition){} and instead of else code warna bhai{}.
- Loops : Loop code block jab tak bhai(condition){}
- Jumping Statement :Break the loop with bas kar bhai (break) and continue within it with agla dekh (continue) bhai.
- Syntax Error : It throws a syntax error with Kya kar rha hai tu statement.
- Output : bhailang <your file name>
- Single line comment : //this is single line comment , Multi line comment : /*This is multi line comment*/.
Environment Setup :
First of install visual studio code : Download vs code
Make sure you have Node.js installed. Download it using the link below if you haven’t already.: node.js
After installing node.js and vs code open one empty folder in your vs code.
Open Terminal given in top the menubar in your vs code.
Install bhaiLang package globally by using this command : npm i -g bhailang
In Visual Studio code go to Extensions or press Ctrl + shift + x to open extensions. Search Bhailang – syntax highlight, autocomplete extension and install it.
Example - 1 Print Hello World using bhaiLang programming language:
//Entery point start here
hi bhai
//Printing statement
bol bhai "Hello World";
//End point start here
bye bhai
Ouput :
Example - 2 Find Positive or Negative number using bhaiLang programming language :
//Entery point start here
hi bhai
//Printing statement
bol bhai "let's find positive and nagative number";
//Variable decleration
bhai ye hai a=5;
bhai ye hai b=-1;
//If else condition
agar bhai(a<0){
bol bhai "a is positive number";
}
warna bhai{
bol bhai "a is nagative";
}
//End point start here
bye bhai
Ouput :
Example - 3 Print 1 to 5 using loop in bhaiLang programming language :
//Entery point start here
hi bhai
//Printing statement
bol bhai "Print 1 to 5 using loop";
//Variable decleration
bhai ye hai f=1;
bhai ye hai e=0;
//loop
jab tak bhai(f<=5){
e+=1;
bol bhai e;
f+=1;
}
//End point start here
bye bhai
0 Comments
Enter Your Comment