Yes it's not a spelling mistake but forr loop in C#.It's the reverse for loop. In this article, we will look into that.
Introduction
Yes it's not a spelling mistake but forr loop in C#.It's the reverse for loop. In this article, we will look into that.
Straight to program
Now to be so surprise.(: The VS intellisense shows up

As it says "Tab twice to insert the 'forr' snippet", so we go
using System;
using System.Collections.Generics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
for (int i = length - 1; i >= 0; i--)
{
}
}
}
}
The code snippet is very similar to the normal for loop but length variable is assigned to the index variable in decreasing manner.
So let us write a small program as under
using System;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int length = 10;
for (int i = length - 1; i >= 0; i--)
{
Console.WriteLine(i);
}
Console.ReadKey();
}
}
}
Output
---------
9
8
7
6
5
4
3
2
1
0
Conclusion
Hope this will be helpful for the newbies.Thanks for reading.