Nullable Variables
int? age = null; // age is a nullable variable that is currently null
if (age != null)
{
// The variable has a value, so you can use it
int currentAge = age.Value; // Access the actual value using the ".Value" property
Console.WriteLine("Age: " + currentAge);
}
else
{
// The variable is null, so it doesn't have a value
Console.WriteLine("Age is not available.");
}Last updated