• Kipper

    v0.12.1
  • Downloads

  • Docs

  • Playground

  • Changelog

  • Kipper

    v0.12.1
    • Downloads

    • Docs

    • Playground

    • Changelog

      • 0.10.4 /
      • Datatypes /
      • Boolean Type
    Kipper Docs
    • next
    • latest
    • 0.11.0
    • 0.10.4
    • 0.9.2
    • Overview

    • Quickstart

    • Goals for Kipper

    • Supported platforms

    • Usage Examples

      • Overview

      • Compiler Setup

    • Variables

      • Overview

      • String Type

      • Number Type

      • Boolean Type

      • Void Type

      • Null Type

      • Undefined Type

      • Array Type

      • Overview

      • Arithmetic Expression

      • Assignment Expression

      • Conditional Expressions

      • Logical Expressions

      • Relational Expressions

      • Convert Or Cast Expression

      • Function Call Expression

      • Overview

      • Expression Statement

      • If Statement

      • While Loop

      • Do-While Loop

      • For Loop

      • Compound Statement

      • Jump Statement

    • Functions

    • Comments

    • Built-in Functions

      • 0.10.4 /
      • Datatypes /
      • Boolean Type
    • 0.10.4 /
    • Datatypes /
    • Boolean Type

    Edit page

    Boolean Type - bool

    The boolean is a simple binary value that may be either true or false. The value can be also represented as 0 (false) and 1 (true).

    Booleans are commonly used in conditional statements and loops, where relational expressions and logical expressions are used to determine the flow of the program, and implement complex logic.

    Examples

    Simple bool variable definitions

    var var1: bool = false;
    var var2: bool = true;

    Comparison of two numbers

    var var3: num = 3;
    var var4: num = 48;
    var equal: bool = var10 <= var11; // 3 smaller than 48 -> True

    Using a boolean as a number

    var var5: bool = True;
    var var6: num = (var18 as num) + 2; // -> 3

    Using a boolean inside an if statement

    • External boolean variable:
      var var7: bool = externalNumber % 10 == 0;
      if (var7) {
          // This code will be executed
      } else {
          // This code will not be executed
      }
    • Direct boolean expression (relational expressions or logical expressions):
      if (externalNumber % 10 == 0) {
          // This code will be executed
      } else {
          // This code will not be executed
      }

    Using a boolean inside a while loop

    • External boolean variable:
      var var8: bool = validNumber(1);
      while (var8) {
          // This code will be executed
          var8 = false;
      }
    • Direct boolean expression (relational expressions or logical expressions):
      while (validNumber(1)) {
          // This code will be executed
      }
  • Developed at:

    • Releases
    • GitHub
    • Security
    • Issue Tracker
    • License
  • Copyright © 2021-2025 Luna Klatzer, 2024-2025 Lorenz Holzbauer & Fabian Baitura.
    Kipper is licensed under the GPL-3.0-or-later license.