- Home /
How do i declare a Boolean Array?
How do i declare a boolean array?
Answer by jashan · Sep 14, 2010 at 08:20 AM
In UnityScript aka JavaScript:
var myArray1 : boolean[];
var myArray2 : boolean[] = new boolean[10];
... I'm not sure if the 3rd option I posted in the C# answer is also possible in UnityScript (I didn't find a way to do it but I neither like UnityScript nor use it a lot ;-) ).
Answer by jashan · Sep 14, 2010 at 08:13 AM
In C#:
bool[] myArray;
or:
bool[] myArray = new bool[10];
if you want to declare an array with 10 "slots". Or:
bool[] myArray = new bool[]{ true, true, false, true };
if you already want to assign it some values.
Your answer
![](https://koobas.hobune.stream/wayback/20220613073202im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Saving 30 bools in an array possible? 2 Answers
TurnBased RPG Help, Checking booleans with an array. 0 Answers
Initialize boolean array as all true Unity JS 2 Answers
Array with boolean variables? 3 Answers
Adding booleans to array and randomize 0 Answers