TrueFalseFormat

Return Yes/No based on whether the input is true/false

Method Signature

TrueFalseFormat(value=[any])

Arguments

Argument
Type
Required
Description
Default

value

any

true

The value to check for true/false and return Yes/No

Examples

Numeric 1 is interpreted as true

Run Example

trueFalseFormat( 1 );

Result: true

Numeric 0 is interpreted as false

Run Example

trueFalseFormat( 0 );

Result: false

String representation of 1 is interpreted as true

Run Example

trueFalseFormat( "1" );

Result: true

String representation of 0 is interpreted as false

Run Example

trueFalseFormat( "0" );

Result: false

YES is recognized as synonym for true as well

Run Example

trueFalseFormat( "YES" );

Result: true

And NO as synonym for false

Run Example

trueFalseFormat( "NO" );

Result: false

An empty string results in false again

Run Example

trueFalseFormat( "" );

Result: false

Additional Examples

<bx:output>
	False: #trueFalseFormat( false )#<br>
	True: #trueFalseFormat( true )#<br>
	0: #trueFalseFormat( 0 )#<br>
	1: #trueFalseFormat( 1 )#<br>
	No: #trueFalseFormat( "No" )#<br>
	Yes: #trueFalseFormat( "Yes" )#
</bx:output>

Last updated

Was this helpful?