1.7 KiB
1.7 KiB
title | description | menu | weight | flux/v0/tags | introduced | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
array.toBool() function | `array.toBool()` converts all values in an array to booleans. |
|
201 |
|
0.184.0 |
array.toBool()
converts all values in an array to booleans.
Supported array types
[string]
with valuestrue
orfalse
[int]
with values1
or0
[uint]
with values1
or0
[float]
with values1.0
or0.0
Function type signature
(<-arr: [A]) => [bool]
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
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]