I have a Loop like this
int numberofelements=20;
for(int i=0;i<numberofelements;i++)
{
if(i==numberofelements)
{
break;
}
if(i==i+1))
{
//do some thing
}else
{
//do some thing else
}
}
As obvious this gives the runtime exception for the final element of the list: Index was out of range. Must be non-negative and less than the size of the collection.
how do i handle this on the last element of this list not to check the condition i==i+1?
Why not do the following: