Numbers

Learn how to declare numbers and perform arithmetic in BornomalaScript.

Numbers

Numbers are used when your program needs to count, calculate, compare, or measure something.

In BornomalaScript, you can work with whole numbers and decimal values.

Basic Example

Declare numbers and do math:

dhoro x = 10 // integers
dhoro y = 3.14 // decimals
lekho(x + y) // prints the summmation
lekho(x - y) // prints the subtraction
lekho(x * 2) // prints the multiplication
lekho(x / 2) // prints the quotient

This example shows the four basic arithmetic operations:

  • Addition with +
  • Subtraction with -
  • Multiplication with *
  • Division with /

How It Works

The first line stores a whole number in x.

The second line stores a decimal number in y.

The remaining lines use those numbers in calculations and print the results.

That means numbers are not only for math class. They are used in age checks, totals, scoring systems, statistics, and many other real programs.

Integers and Decimals

Numbers usually come in two beginner-friendly forms:

  • Integers: whole numbers like 10, 25, or 100
  • Decimals: values like 3.14, 2.5, or 9.99

Both types are important, and you should practice using each one.

Step-by-Step Breakdown

Read the example line by line:

  1. dhoro x = 10 stores a whole number
  2. dhoro y = 3.14 stores a decimal number
  3. x + y adds the two values together
  4. x - y subtracts one value from the other
  5. x * 2 doubles the value of x
  6. x / 2 divides the value of x by 2

This is the foundation of numeric programming.

Save and Run the File

Create a file named numbers.bs, paste the example code, save it, and run:

bs run numbers.bs

When the program runs, the terminal should show the results of the math expressions.

Try These Variations

Practice with your own numbers:

dhoro a = 5
dhoro b = 7
lekho(a + b)
dhoro price = 150
dhoro tax = 15
lekho(price + tax)
dhoro distance = 42.5
lekho(distance / 2)

Changing the values helps you understand how the operations behave.

Common Mistakes

Beginners often make a few common mistakes with numbers:

  • Using quotes around numbers when the value should stay numeric
  • Typing a decimal incorrectly
  • Forgetting that division changes the result
  • Mixing up number variables with text variables
  • Expecting concatenation instead of arithmetic

If the result looks strange, check whether the value was treated as text instead of a number.

Why Numbers Matter

Numbers are used in almost every practical program:

  • counting items
  • calculating totals
  • measuring time
  • comparing ages
  • scoring points

Once you understand numbers, you are ready for conditions and loops.

Practice Task

Try writing programs that:

  1. Add two numbers
  2. Subtract one number from another
  3. Multiply a value by 3
  4. Divide a number by 2

Example:

dhoro age = 18
lekho(age + 2)

Quick Checklist

Before moving on, make sure you can:

  • Store a whole number in a variable
  • Store a decimal number in a variable
  • Add, subtract, multiply, and divide
  • Run the file and read the output

If yes, you are ready for booleans.