3
Answers

for loop integer starting 0000 and selecting from 9999 downwards?

regor

regor

15y
5.6k
1

Hi,
I am of some expericen with c# but right now I have a project in which I have a string that can start from 0000 and end in 9999 (the string is parsed into a integer).
I want to create a loop which can basically say it starts from 2545 and then go down to 0000 or do it the way round which is start from 0000 and go up to 2545.
Problem starts when I say:
for (int i = 0000; i < myLength; i++)
{
      function;
      response;

}
but in c# I realize it wont like starting from 0000 and instead it starts from 0. how can I make it iterate so it can do 4 digits?
Regards,
Answers (3)