int totalNos = 3000; // It is dynamic value it will change
// i need to split it into 500 nos and execute my code
for (int i = 0; i < 500; i++)
{
// code here
}
for (int j = 500; j < 1000; j++)
{
// code here
}
for (int k = 1000; k < 1500; k++)
{
// code here
}
for (int l = 1500; l < 1500; l++)
{
// code here
}
for(Int32 outer = 0, outer < totalNos, outer = outer + 500)
{
for (int i = outer; i < outer+500; i++)
{
// code here
}
}
@Hisanth i've not tested this, but that's the general idea. you may have to fine tune, for example, if totalNos does not divide evenly by 500; i'm assuming "code here" is the same
for each iteration ... if necessary, create a method for your "code here" section so that you do not repeat yourself.
B-) Gerry Lowry, Chief Training Architect, Paradigm Mentors Learning never ends... +1 705-999-9195 wasaga beach, ontario canada TIMTOWTDI =.there is more than one way to do it
Member
138 Points
357 Posts
how to split array list and excecute using loop
Nov 21, 2014 03:59 AM|Hisanth|LINK
Hi,
Is there any another way to achieve this
Star
14297 Points
5797 Posts
Re: how to split array list and excecute using loop
Nov 21, 2014 04:15 AM|gerrylowry|LINK
@Hisanth i've not tested this, but that's the general idea. you may have to fine tune, for example, if totalNos does not divide evenly by 500; i'm assuming "code here" is the same for each iteration ... if necessary, create a method for your "code here" section so that you do not repeat yourself.