Types/Bool

From SC2Mapster Wiki
Jump to: navigation, search

Bool

  • bool represents a Boolean value with only two possible values: true and false.
  • Boolean values are typically used in conditional statements and all comparison operators (<=, <, >=, >, ==, !=, !) return bool.
bool value = true;
if (value) { // this will be performed
  DoSomething();
} else { // this will not be performed
  DoSomethingElse();
}
value = false;
if (value) { // this not will be performed
  DoSomething();
} else { // this will be performed
  DoSomethingElse();
}
value = !(false); // same as true
value = !(true); // same as false
value = true && true; // true
value = true && false; // false
value = false && true; // false
value = false && false; // false
value = true || true; // true
value = true || false; // true
value = false || true; // true
value = false || false; // false