Program Using Null Coalescing Operator ??
using System;
class Program
{
public static void Main()
{
int AvailableChocolate;
int? ChocolateForSale = null;
AvailableChocolate = ChocolateForSale ?? 0;
Console.WriteLine("Available Chocolate = {0}", AvailableChocolate);
}
}
using System;
class Program
{
public static void Main()
{
int AvailableChocolate;
int? ChocolateForSale = null;
AvailableChocolate = ChocolateForSale ?? 0;
Console.WriteLine("Available Chocolate = {0}", AvailableChocolate);
}
}
No comments:
Post a Comment