Could anyone tell me why the nested for loop in the code below doesn't execute? I.e. The "Hello World" is not printed. The first loop is being executed.
for (int i = 0; i < data.Length; i++)
{// Loop through array
**for (int j = data.Length - 1; j < i; j--)**
{
// Loop backwards through array
**Console.WriteLine("Hello World");**
double subTotal = 0; //Keeps track of current subsequence's value
subTotal += data[j];
if (bbestTotal < subTotal)
{
bbestTotal = subTotal;
}
}
}
datalook like?for (int j = data.Length - 1; j > i; j--)Currently, j will always be bigger than or equal to i, so the terminating condition will fail immediately.