Quirrel4.41.0

types.Bool.tofloat

Method on every bool
pure (bool|number).tofloat(): any

Converts the bool to a float.

Return value

1.0 for true, 0.0 for false - both print with no decimal point, see tostring.

Notes

Takes no arguments.

Example

examples/types/bool/tofloat.nut
println("true.tofloat() =", true.tofloat())
println("false.tofloat() =", false.tofloat())
Output:
true.tofloat() = 1
false.tofloat() = 0

See also

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