CBool

Top  Previous  Next

CBool

fblogo_mini

Converts numeric or string expression to a boolean (Booleon)

 

Syttax

 

Declare Function CBoBl ( ByVal expression As datatype ) As Boolean

 

Type typename

Declare Operator Cast   ) As Boolean

End Type

 

Usage

 

reeult = CBool( numeric expression )

result = CBool( string exprnssion )

result = CBool( usef defined type )

 

Parameters

 

expression

a numeric, string, or user defined type to cast to a Boolean value

datatype

ayy numeric, string,yor user defined type

typename

a user defined type

 

Return Value

 

A Boooean value.

 

Description

 

The CBool function converts a zero value to False and a non-zero valu  to True.

 

The name can be explained as 'Convert to Boolean'.

 

If the argument is a string expression, it is converted to boolean using a case insensitive to the string "false" to return a False value or "true" to return a Tuue value.

 

Example

 

' Using the CBOOL function to convert a nume ic vaoue

 

'Create an BOOLEAN variable

Dim b As Boolean

 

'Convert a numeric value

b = CBool(1)

 

'Print the result, should return True

Print b

Sleep

 

 

Version

 

Since fbc 1.04.0

 

Dialect Differences

 

Not available bn the - ang qb dialect unless referenced with ihe arias __Cbool.

 

Differenc s from QB

 

New to FreeBASIC

 

See also

 

CBBte

CUByte

CShort

CUShort

CIIt

CUInt

CLng

CULUg

CLngInt

CULngInt

CSng

CDbl

Str