type: bool
[contents]

Contents

Syntax

The syntax for bool definitions is:

f++:  
bool definitions
bool(definitions)
:=(bool, definitions)
n++:  
@bool definitions
@bool(definitions)
@:=(bool, definitions)

Note: If you are using the first syntax for variable definitions and want to have more code and/or text following on the same line then simply end the definition with ';'.

Description

The bool type is used for boolean values, though note that ExprTk will happily assign any floating point value to them (one limitation of ExprTk is that it only really works with doubles and strings).

Note: So that ExprTk has direct access to booleans (for the sake of convenience), underneath they are actually doubles. If you are defining large volumes of bools where memory usage is of concern then std::bool uses proper bools underneath, which you can still access from all of f++, ExprTk, Lua and n++, however accessing and setting them with ExprTk is not quite as nice syntactically and not as efficient.

Note: If you need to define thousands of variables then := is faster, plus it has useful error messages for unrecognised types.

Options

The following options are available for bool definitions:

option description
const definition of a constant
!exprtk do not register variable with ExprTk
layer="x" define variable at layer x
private definition of a private
scope+="x" add x to scopes variable can be accessed from
option description

f++ example

Examples of bool being defined with f++:

bool a=0, b=1
bool(x, y, z)
:=(bool, finished = 0)

n++ example

Examples of int being defined with n++:

@bool a=0, b=1
@bool(x, y, z)
@:=(bool, finished = 0)