Boolean

Operators and functions for working with boolean (bool type) are described here.

Operators

Operator

Result

Description

bool && bool

bool

Logical AND operator. If both the operands are true then condition becomes true.

bool || bool

bool

Logical OR Operator. If any of the two operands is true then condition becomes true.

! bool

bool

Logical NOT Operator.

bool = bool

bool

Assignment operator.

Functions

int(bool b) int

The int function returns 1 if the parameter is true and returns 0 otherwise.

str(bool b) str

The str function returns the "true" if the parameter is true and returns the "false" otherwise.

Last updated