cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1132
Views
5
Helpful
1
Replies

how to assign a value to an array member?

bphelps
Level 2
Level 2

I create an array variable, and later set it to be Q[0] = 123. When the script hits that step it complains ?invalid null array?. How do I assign a value to a member of an array?

B

1 Reply 1

bphelps
Level 2
Level 2

Very well, I'll answer my own question. Unlike other variables in the scripting tool, the array length needs to be declared. So, clumsily, you can declare an array like so:

1. Make an int variable called Q, make it an array

2. Set Q= new int[6]

3. Set Q[0]=1

That creates a six member array like so {1,0,0,0,0,0}

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: