Question: I have a quick question how can I loop over an NSMutable array starting from a certain index. 
For Example I have these double loops I want k to start from the same index as l. 

```
for (Line *l in L)
    {
        for (Line *k in L)
        {
............
        }
    }

```

To elaborate further, lets say L has 10 object so l start from 0-10 and k from 0 -10. What I want is if l is equal 1 k should start from 1-10 rather than 0 - 10 and when l is equal 2 k should start from 2- 10 rather than 0. Any help is Appreciated

Answer: 
Objective-C is an extension of C, lookup the C `for` loop and you'll have your answer. HTH

**Addendum**

I was going to let you benefit from the learning experience of looking up the C `for` yourself, however at the time of writing all other answers since added give the code but it is not complete, so here is what you need to produce the `l` and `k` values in the order you wish:

```
for(NSInteger lIndex = 0; lIndex < L.count; lIndex++)
{
   Line *l = L[lIndex]; // index into your array to get the element
   for(NSInteger kIndex = lIndex; kIndex < L.count; kIndex++)
   {
      Line *k = L[kIndex];
      // process your l and k
   }
}

```

As you can see the `for` has three sub-parts which are the *initialisation*, *condition*, and *increment*. The *initialisation* is performed first, then the *condition* to determine whether to execute the `for` body, and the *increment* is executed after the statements in the body and before the *condition* is tested to determine if another iteration should be performed. A `for` loop is roughly (there are some differences that are unimportant here) to the `while` loop:

```
initialisation;
while(condition)
{
    body statements;
    increment;
}

```
You have to use an indexed (ordinary) `for` loop instead of fast enumeration (`for-in`):

```
int l;
for (l=startValue; l<=endValue; l++)
{
    int i;
    for (int i=l; i<=endValue; i++) 
    {
      …
    }
}

```