0

I have an array of ints (I.E: 12 , 55 , 33) the length and contents of that array are variable. In a for each loop, I need to take every single array index and create a set number of ui images based on its number, for example if the first array element = 5, I need to create 5 images, then move on to the next element and do the same, and so on...

Can anybody help me with this please?

  • What are you stuck on? Creating a for loop to iterate over the array elements, doing something N times based on the entry or creating the image? Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. – T. Kiley Oct 25 '15 at 15:55

1 Answers1

0
foreach (int numImages in array) 
{
    for (int i = 1; i <= numImages; i++)
    {
        CreateImage();
    }        
}
erictrigo
  • 989
  • 2
  • 13
  • 41