C# newbie and confused as to why this isn't working.
Suppose I have an array of {1 , 2 , 3}.
How would I loop through this array to change the values by a set increment, for example if the increment is 1:
{1 , 2 , 3} becomes {2 , 3 , 4}
and if its 2 it becomes {3 , 4 , 5} etc.
Here is my attempt -
foreach (int i in ls)
{
int index = i + increment;
}
for-loop:for(int i=0;i<ls.Length;i++){ls[i]+=increment;}