Quirrel4.41.0

types.Bool.tostring

Method on every bool
pure tostring(): any

Converts the bool to its string form.

Return value

The literal word "true" or "false" - not "1"/"0", unlike tointeger.

Notes

Takes no arguments; see types.Integer.tostring for the shared arity error. null has no tostring method to compare against: it is not callable as a method, only formatted implicitly (as "null") when the VM converts it for print or string concatenation.

Example

examples/types/bool/tostring.nut
println("true.tostring() =", true.tostring())
println("false.tostring() =", false.tostring())
println("type(true.tostring()) =", type(true.tostring()))
Output:
true.tostring() = true
false.tostring() = false
type(true.tostring()) = string

See also

tostringConverts the integer to its decimal string form.
tostringConverts the float to its string form.
tointegerConverts the bool to an integer.
boolclass index