x


How do i declare a Boolean Array?

How do i declare a boolean array?

more ▼

asked Sep 14, 2010 at 08:00 AM

Dom gravatar image

Dom
28 9 6 10

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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 ;-) ).

more ▼

answered Sep 14, 2010 at 08:20 AM

jashan gravatar image

jashan
11.5k 45 60 138

(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Sep 14, 2010 at 08:13 AM

jashan gravatar image

jashan
11.5k 45 60 138

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2188
x417

asked: Sep 14, 2010 at 08:00 AM

Seen: 18392 times

Last Updated: Sep 04, 2012 at 10:54 PM