IsBoolean

Determine whether a given object is a boolean

Method Signature

IsBoolean(object=[any])

Arguments

Argument
Type
Required
Description
Default

object

any

true

The value to test for boolean-ness.

Examples

Yes

Yes is considered a boolean that is true

Run Example

isBoolean( "yes" );

Result: true

No

No is considered a boolean that is false

Run Example

isBoolean( "no" );

Result: true

Maybe

Maybe is not considered a boolean

Run Example

isBoolean( "maybe" );

Result: false

True

true is a boolean

Run Example

isBoolean( true );

Result: true

False

false is a boolean

Run Example

isBoolean( false );

Result: true

Zero

0 is considered a boolean that is false

Run Example

isBoolean( 0 );

Result: true

Non Zero Integer

23 is considered a boolean that is true

Run Example

isBoolean( 23 );

Result: true

Additional Examples

Run Example

writeDump( IsBoolean( true ) );
writeDump( IsBoolean( false ) );
writeDump( IsBoolean( 0 ) );
writeDump( IsBoolean( -10.4 ) );
writeDump( IsBoolean( 3.6 ) );
writeDump( IsBoolean( "yes" ) );
writeDump( IsBoolean( "no" ) );
writeDump( IsBoolean( "true" ) );
writeDump( IsBoolean( "false" ) );
writeDump( IsBoolean( "0" ) );
writeDump( IsBoolean( "-10.4" ) );
writeDump( IsBoolean( "3.6" ) );

Run Example

writeDump( IsBoolean( Now() ) );
writeDump( IsBoolean( {} ) );
writeDump( IsBoolean( [] ) );
writeDump( IsBoolean( QueryNew( "" ) ) );
writeDump( IsBoolean( "" ) );
writeDump( IsBoolean( "a string" ) );

Last updated

Was this helpful?