currently need help with constructing an array. i have the following code

array[1] =1

array[2] = 2

array[3] = 3

array[4] = 4

array[5] = 5

array[6] = 6

array[7] = 7

array[8] = 8

array[9] = 9

is there any way i can shorten that code?

for example in c++ i can write

int array[] = {1,2,3,4,5,6,7,8,9}