Docs Installation Playground Explore AST

Set on System Basis

Syntax Overview of BroCode

BroCode syntax is designed to be simple and relatable, making coding feel like a breeze. Let’s break down the essentials you’ll need to start coding like a pro.


Quick Reference 🛠️

Variable Declaration

Declare variables using 'maanle' – simple and straight to the point!

BROCODE
bro maanle x hai 10;

You can declare a variable by specifying its name and assigning it a value. It's that easy!

Conditionals

Conditional statements use 'agar' – check if something is true or false.

BROCODE
bro agar (x > 5) { 
  bro dikha de("X is greater than 5"); 
}

Conditionals let you control the flow of your program based on certain conditions, just like 'if' statements in other languages.

Loops

Use 'jbb tk' for loops – loop while a condition is true!

BROCODE
bro jbb tk (x < 10) { 
  bro dikha de(x); 
  x++; 
}

Loops are perfect for repeating actions until a condition is no longer true. 'jbb tk' is like a while loop.

Print Statement

Print values or messages using 'dikha de'.

BROCODE
bro dikha de("Hello, BroCode!");

Use this to output messages or variable values. It’s equivalent to 'console.log' in JavaScript.

Functions

Define functions using 'function' and call them as needed.

BROCODE
bro function ADD(a, b) { 
  bro dikha de(a + b); 
} 
ADD(5, 3);

Functions allow you to organize code into reusable blocks. Define once, use many times!

Example 💡

1Function Example

Define and call a function to add two numbers and display the result.

BROCODE
bro function ADD(a, b) { 
  bro dikha de(a + b); 
} 
ADD(5, 3);
This example shows how to create a function that adds two numbers and displays the result.

BroCode © 2024. All rights reserved.