Ir para o conteúdo principal
CloudStudio

ToBoolean

The ToBoolean function converts a value of any type to boolean.

Definition

ToBoolean(valor)

Parameters

NameDescriptionData type
valorValue to convert to boolean. If the value is numeric, it will be converted to false when the value is zero, and to true in any other case. If the value is a string, it will be converted to false when the text is 'false' or '0', and to true when the text is 'true' or '1'. The function will produce an error in any other case. If the value is already boolean, the same value is returned.any

Examples

Numeric value conversion

In the following example, 'false' should be displayed if the received value is zero and 'true' if the received value is not zero. This example uses the If function for the comparison; for more information about this function go here.

ToBoolean(125)

The result of this expression is true (boolean).

String value conversion

ToBoolean('0')

The result is false (bool).

Última atualização em

Nesta página