Language Basics C# Book

using System;
using System.IO;
class Test
{
static void Main()
{
int? x = 5;
int? y = null;
// Equality operator examples
Console.WriteLine(x == y);
// False
Console.WriteLine(x == null); // False
Console.WriteLine(x == 5); // True
Console.WriteLine(y == null); // True
Console.WriteLine(y == 5); // False
Console.WriteLine(y != 5); // True
// Relational operator examples
Console.WriteLine(x < 6); // True
Console.WriteLine(y < 6); // False
Console.WriteLine(y > 6); // False
// All other operator examples
Console.WriteLine(x + 5); // 10
Console.WriteLine(x + y); // null (prints empty line)
}
}
The output:
False
False
True
True
False
True
True
False
False
10