Null-Coalescing Goals

CSharp · Console

/Program.cs

using System;
using System.Linq;
					
public class Program
{
	public static void Main()
	{
		#nullable enable
		string goal = null;
		string[] goals = null;
		
		goal = goal?? "Think of one thing.";
		goals = goals?? new string[]{"Goal One", "Goal Two"};
		
		Console.WriteLine(goal);
		goals.ToList().ForEach(x => Console.WriteLine(x));
		
	}
}
;