This is something I wasn't aware of . . . after 20 odd years
The for loop control can have additional statements which execute along with the
initialise statement and increment/step statement
but apparently not with the test statement.
something new every day is a good thing !
// See https://aka.ms/new-console-template for more information
using System;
namespace Basics;
class Program
{
static void Main()
{
Console.WriteLine("Hello, CH02 : Vocabulary");
Console.WriteLine($"Namespace: {typeof(Program).Namespace}\n");
int i;
int j = 3;
for (i = 0, Console.WriteLine($"Start: i={i}, j={j}");
i < j;
i++, j--, Console.WriteLine($"Step: i={i}, j={j}"))
{
//...
}
/*
Hello, CH02: Vocabulary
Namespace: Basics
Start: i = 0, j = 3
Step: i = 1, j = 2
Step: i = 2, j = 1
*/
}
}