bool

Prev Next

Function Names

bool

Description

This function converts a value to a voolean value.

Vectorization: This function supports vectorization in the 1st function parameter. Instead of providing a single value, you can provide a set or even a nested set which contain multiple values. The function will then process every value and its return value contains a corresponding set containing all results.

Call as: function

Restrictions

Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter

Parameter count

1

Parameters

No.TypeDescription
1
input
valid types Value

Strings returning true:true, yes, '1' (not case sensitive, and also in other supported languages)
Strings returning false:false, no, '0', '-', '' (blank) (not case sensitive, and also in other supported languages)
Numerals: 0 (including near 0 as ruled by epsilon as defined in the systeml variable runtime settings[epsilon]<.br> Booleans are passed through.
Date: Blank dates return false, otherwise true.
Sets: Vectorization will apply in order to process multiple values inside (nested) sets.

Return value

TypeDescription
boolean
set
Result

Identified boolean value. A set containing multiple values is returned if vectorization is used.

Examples

               echo( bool(TRUE), " ", bool(Falsch) );        // true, false
               echo( bool("Ja"), " ", bool("No") );      // true, false
               echo( bool("1"), " ",  bool(0) );           // true, false
               echo( bool({{Yes,Ja},{No,Nein}} ) );            // Vectorization: {{true,true},{false,false}}
               echo( bool( { date( '10:30:00' ), date("") } ) );     // true, fasle

Output

true false
true false
true false
{{true,true},{false,false}}
{true,false}
Try it yourself: Open LIB_Function_bool.b4p in B4P_Examples.zip. Decompress before use.