Bool

From Esolang
Jump to navigation Jump to search

Bool was created by User:xmlns. In bool, the only data type is (guess what!) a Boolean. It allows for both objects and functions. All variables must start with a dollar sign($). A double-slash (//) is used to comment. Instructions are delimited by a semicolon(;). A number acts as a bool[], i.e. the number 5 is [1,0,1]. A char acts as its ASCII binary value as a bool[8], and a string acts as its ASCII value as a bool[8][]. Newlines are not included as part of an input. Bool's only functions/objects are:

bool
$in
$out
and
or
not
if
while

To initialize $a, use:

bool() $a; //or
bool(1) $a //(sets a to 1), or
bool(0) $a //(sets a to 0)

To create the a "byte" object, use:

Object char {
  constructors{
    ( bool[8] $a );
    ();            //allow a char to be formed with or without an initial value
  }
  default{
    $a = (bool[8]) 0;  //if a is not specified, set a to [0,0,0] using a type cast
  }
  value = $a;
}
char[]($in) $char;
$out = $char;

This program asks for an input and displays the input.

void hello {
  constructors{
    ( bool[8][] $name ) ;
  }
  $out = "Hello, $name!";
}
$namein = $in;
hello( $namein );

This program asks the user for a name and greets them.