Booleans

Learn how true and false values work in BornomalaScript conditions.

Booleans

Booleans are values that only have two states: true or false.

In BornomalaScript, booleans help you decide what your program should do next.

Basic Example

Use sotto and mittha in conditions:

dhoro approved = sotto
jodi (approved) tahole {
  lekho("Access granted")
} nahole {
  lekho("Access denied")
}

This example uses a boolean variable named approved.

If the value is true, the program prints one message.

If the value is false, the program prints the other message.

How It Works

Booleans are usually used inside conditions because they tell the program whether something is allowed, available, correct, or ready.

That means booleans are useful for:

  • login checks
  • permission checks
  • yes/no questions
  • feature flags
  • simple logic decisions

True and False

The two boolean values in this lesson are:

  • sotto for true
  • mittha for false

You can switch between them to test how the condition changes.

Example:

dhoro approved = mittha
jodi (approved) tahole {
  lekho("Access granted")
} nahole {
  lekho("Access denied")
}

Step-by-Step Breakdown

Read the example carefully:

  1. A boolean variable is created
  2. The value is set to sotto
  3. The condition checks whether the value is true
  4. If it is true, the first message runs
  5. Otherwise, the nahole block runs

This pattern is the foundation of decision-making in programming.

Try These Variations

Practice with different boolean values:

dhoro loggedIn = sotto
jodi (loggedIn) tahole {
  lekho("Welcome back")
} nahole {
  lekho("Please log in")
}
dhoro isStudent = mittha
jodi (isStudent) tahole {
  lekho("Student access")
} nahole {
  lekho("General access")
}
dhoro paid = sotto
jodi (paid) tahole {
  lekho("Payment received")
} nahole {
  lekho("Payment pending")
}

These examples show how booleans control behavior in real programs.

Why Booleans Matter

Booleans are small, but they are extremely important because almost every program needs decisions.

They help you build logic for:

  • access control
  • form validation
  • user choices
  • loops and repeats
  • feature settings

Once you understand booleans, conditions become much easier to read.

Common Mistakes

Beginners often make a few common mistakes with booleans:

  • Using the wrong true/false keyword
  • Forgetting that the condition checks a value
  • Writing the condition in the wrong place
  • Expecting both branches to run at the same time
  • Using text instead of a boolean when logic is needed

If the condition behaves unexpectedly, check the boolean value first.

Practice Task

Try writing your own boolean examples:

  1. A variable that checks whether a user is logged in
  2. A variable that checks whether a score is passing
  3. A variable that checks whether a book is available
  4. A variable that checks whether a task is finished

Example:

dhoro ready = sotto
jodi (ready) tahole {
  lekho("Cholo shuru kori")
} nahole {
  lekho("Aro ektu wait")
}

Quick Checklist

Before moving on, make sure you can:

  • Create a boolean variable
  • Set it to sotto or mittha
  • Use it inside a condition
  • Read the output from both branches

If yes, you now understand the basic idea behind logical decisions in BornomalaScript.