Spot the bug in the callback loop

from Delegates and events
C# 14 / .NET 10 intermediate 4 min 1 issue to find

Find why every callback prints the same value after the loop.

csharp
using System;
using System.Collections.Generic;

var callbacks = new List<Action>();
for (int i = 0; i < 3; i++)
    callbacks.Add(() => Console.WriteLine(i));

foreach (Action callback in callbacks)
    callback();
Open in playground
Report an error