{{fbdoc item="title" value="CBOOL"}}----
Converts numeric or string expression to a boolean (##[[KeyPgBoolean|Boolean]]##)

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Cbool** ( [[KeyPgByval|byval]] //expression// [[KeyPgAs|as]] [[DataType|datatype]] ) [[KeyPgAs|as]] [[KeyPgBoolean|boolean]]
	
	[[KeyPgType|Type]] //typename//
		[[KeyPgDeclare|declare]] [[KeyPgOperator|operator]] [[KeyPgCast|cast]] ( ) [[KeyPgAs|as]] [[KeyPgBoolean|boolean]]
	End Type
##
{{fbdoc item="usage"}}##
	//result// = **Cbool**( //numeric expression// )
	//result// = **Cbool**( //string expression// )
	//result// = **Cbool**( //user defined type// )
##
{{fbdoc item="param"}}
	##//expression//##
		a numeric, string, or user defined type to cast to a ##[[KeyPgBoolean|Boolean]]## value
	##//datatype//##
		any numeric, string, or user defined type
	##//typename//##
		a user defined type

{{fbdoc item="ret"}}
	A ##[[KeyPgBoolean|Boolean]]## value.

{{fbdoc item="desc"}}
	The ##**Cbool**## function converts a zero value to ##[[KeyPgFalse|False]]## and a non-zero value to ##[[KeyPgTrue|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 ##[[KeyPgFalse|False]]## value or "true" to return a ##[[KeyPgTrue|True]]## value.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/casting/boolean.bas"}}%%(freebasic)
' Using the CBOOL function to convert a numeric value

'Create an BOOLEAN variable
DIM b AS BOOLEAN

'Convert a numeric value
b = CBOOL(1)

'Print the result, should return True
PRINT b
SLEEP
%%

{{fbdoc item="lang"}}
	- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Cbool""**##.

{{fbdoc item="diff"}}
	- New to ""FreeBASIC""

{{fbdoc item="see"}}
	- ##[[KeyPgCbyte|Cbyte]]##
	- ##[[KeyPgCubyte|Cubyte]]##
	- ##[[KeyPgCshort|Cshort]]##
	- ##[[KeyPgCushort|Cushort]]##
	- ##[[KeyPgCint|Cint]]##
	- ##[[KeyPgCuint|Cuint]]##
	- ##[[KeyPgClng|Clng]]##
	- ##[[KeyPgCulng|Culng]]##
	- ##[[KeyPgClngint|Clngint]]##
	- ##[[KeyPgCulngint|Culngint]]##
	- ##[[KeyPgCsng|Csng]]##
	- ##[[KeyPgCdbl|Cdbl]]##
	- ##[[KeyPgStr|Str]]##

{{fbdoc item="back" value="CatPgCasting|Converting Data Types"}}