Bool
From ZCWiki
The keyword bool is used to define variables as boolean types (having a value of either true or false) and to indicate that functions return boolean values.
[edit] Examples
The first example demonstrates how to declare boolean variables.
bool Link_Is_OK = true;
The second example demonstrates how to declare a function that returns a boolean value.
bool StillAlive(){
return Link->HP > 0;
}
[edit] Details
Variables defined as bool can store a value of true or false, and can be used in logical (boolean) expressions.
ZScript (like the C programming language) will consider any non-zero number to have a true value. Thus, the following code is valid (even if it doesn't make too much sense):
if(42){
// The statements in this block will
// always be executed, because
// the number 42 always has a
// value of true.
}
Note that the compiler will give you a warning, but the script will compile and execute as noted above. See typecasting for additional details.
