Aller au contenu

Photo

Native array constructor?


  • Veuillez vous connecter pour répondre
Aucune réponse à ce sujet

#1
Magic

Magic
  • Members
  • 187 messages
I have a question about arrays: Is there a syntax (or workaround?) to create an array directly as a whole? Like

int[] MyArray = { 1,2,3 };

instead of

int[] MyArray;
MyArray[0] = 1; MyArray[1] = 2; MyArray[2] = 3;

I could use a custom function, yes, but the number of parameters is limited. I hope the workaround doesn't involve using a recursive function, though. :lol: