Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

how to assign a value to an array member?

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
New Member

Re: how to assign a value to an array member?

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}

411
Views
5
Helpful
1
Replies