Documentation

array.toBool() function

array.toBool() is experimental and subject to change at any time.

array.toBool() converts all values in an array to booleans.

Supported array types

  • [string] with values true or false
  • [int] with values 1 or 0
  • [uint] with values 1 or 0
  • [float] with values 1.0 or 0.0
Function type signature
(<-arr: [A]) => [bool]
For more information, see Function type signatures.

Parameters

arr

Array of values to convert. Default is the piped-forward array (<-).

Examples

Convert an array of integers to booleans

import "experimental/array"

arr = [
    1,
    1,
    0,
    1,
    0,
]

array.toBool(arr: arr)// Returns [true, true, false, true, false]

Was this page helpful?

Thank you for your feedback!


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.