Publish an event when score changes.
Loose coupling between gameplay and UI uses events:
```csharp
class ScoreBoard
{
public event Action<int>? OnScoreChanged;
private int score;
public void Add(int points)
{
score += points;
OnScoreChanged?.Invoke(score);
}
}
```
Subscribe with `board.OnScoreChanged += s => Console.WriteLine(s);` and call `board.Add(10);`.Sign in to save your code and track progress across devices.