How to create a Bool array and how to turn it all '= false' in one command?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Moot Point
:bust_in_silhouette: Reply From: jgodfrey

AFAIK, there’s no built-in way to assign a single value to every element in an array. But, you can easily do that with a helper function. Here’s an example…

func _ready():
	var boolArray = [true, true, true, false, false]
	print(boolArray)
	set_bool_array(boolArray, false)
	print(boolArray)

func set_bool_array(array, value):
	for i in range(0, array.size()):
		array[i] = value