DEV Community

amananandrai
amananandrai

Posted on

Programs using Bhailang

Bhailang is a language which has taken the social media in India by storm. According to its documentation the developers of this language has described it as

Bhailang is dynamically typed toy programming language, based on an inside joke, written in Typescript.

I have written two programs using this language the first one prints table of 3 and the next one explains the syntax for nested loops and ladder if statements in the language.

Program for Table of 3



hi bhai

  bhai ye hai a = 3;
  bhai ye hai b = 0;

  jab tak bhai (b < 10) {
    b += 1;
    bol bhai a," * ", b, " = ", a*b  ;
  }

bye bhai


Enter fullscreen mode Exit fullscreen mode

Output of Program


Program for nested loops and ladder if




hi bhai
  //variable declaration
  bhai ye hai a = 0;
  bhai ye hai b = 0;
  bhai ye hai t = 0;

 // Outer while loop
  jab tak bhai (a < 3)
  {
  t = a+1;
  //if statement
  agar bhai (t == 1) 
  { 
    bol bhai "Pehli";
  }
  //else if statement
  nahi to bhai (t == 2)
  { 
    bol bhai "Doosri";
  }
  //else statement
  warna bhai 
  { 
    bol bhai "Teesri";
  }
  bol bhai " baar Bahar" ;
  bhai ye hai b = 0;
  // inner loop
    jab tak bhai (b <= a)
    {
      t = b+1;
      bol bhai  b+1," baar Andar";
      b+=1;
    }
    a += 1;
  }
bye bhai



Enter fullscreen mode Exit fullscreen mode

Output program 2

Others can try different programs using the link given below
https://bhailang.js.org/#playground

Top comments (5)

Collapse
 
vulcanwm profile image
Medea

woah didn't know this was a programming language :0

Collapse
 
thumbone profile image
Bernd Wechner

It's an inside joke of course. But inside of what? What is the real world language this appeals to? Hindi? Or none?

Collapse
 
just_moh_it profile image
Mohit Yadav

Actually, bhai in hindia means bro, and the language can be read in english like

starting: hello bro
ending: bye bro

variable declaration: bro this is a = 10;

The special thing about this is, reading it feels like talking rather than coding, that's why it's so popular...

Collapse
 
thumbone profile image
Bernd Wechner

Thanks for the translation. Reminds me of an unix filter called "jive" that translated text (not code) into jive (a particular flavour ot US street language).

Collapse
 
amananandrai profile image
amananandrai

Hindi is the language which inspired this language