I want to assign integers 1-10 to already existing integer array first 10 values (index 0-9). Is there way to do this quickly without for loop or do I need for loop?
Example:
//already existing array with index 0-14.
//want to change this to {1,2,3,4,5,6,7,8,9,10,1,1,1,1,1}
int[] array = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
What I know:
int x = 1;
for (int a = 0; a < 10; a++)
{
array[a] = x;
x++;
}
Is there faster way, some command perhaps?
Thanks!