0

I was just wondering not just concerning this piece of code but in some other code as well how can i avoid --> if (j!=array.Length-1) and put something else maybe
something in the for loop? LINE6

for (int i = 0; i < array.Length; i++)
            {

               for (j=counter; j < array.Length; j++)
                {
                    if (j!=array.Length-1)
                    {
                        if (array[i] == array[j+1] ) 
                         {
                             array[i] = 0;

                         }
                     }

                }
                if (array[i] != 0)
                {
                    items.Add(array[i]); // storing none duplicates random number.
                }
                counter++;
               }

Edited by castajiz_2: NONE

2
Contributors
1
Reply
9
Views
3 Years
Discussion Span
Last Post by vadriaan
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.