int? x = 10; if (x.HasValue) { Console.WriteLine($"x is {x.Value}"); } else { Console.WriteLine("x does not have a value"); }