for(int i; i>8; i++) in csharp

To create a for loop with an initialization, a condition, and an increment expression in C#, you can use the following syntax:

main.cs
for (int i = 0; i < 8; i++)
{
    // Your code here
}
54 chars
5 lines

This loop will initialize i to 0, and then execute the loop body as long as i is less than 8. After each iteration of the loop body, the expression i++ will be executed to increment the value of i by 1.

If you want to use the for loop to iterate while counting up from a starting value greater than 0, you can adjust the initialization and condition accordingly:

main.cs
for (int i = 9; i <= 12; i++)
{
    // Your code here
}
56 chars
5 lines

This loop will initialize i to 9, and then execute the loop body as long as i is less than or equal to 12. After each iteration of the loop body, the expression i++ will be executed to increment the value of i by 1.

gistlibby LogSnag