Take stars out of types where they make more sense.
[mono-project.git] / mcs / tests / gtest-130.cs
blob6c6c1f1030e61294af775607679c59ae0692d4f3
1 //-- ex-nullable-bool
3 using System;
5 class MyTest {
6 public static void Main(String[] args) {
7 Console.WriteLine("Note that null prints as blank or []\n");
8 bool? b1 = null, b2 = false, b3 = true;
9 bool? b4 = b1^b2, b5 = b1&b2, b6 = b1|b2; // null false null
10 Console.WriteLine("[{0}] [{1}] [{2}]", b4, b5, b6);
11 bool? b7 = b1^b3, b8 = b1&b3, b9 = b1|b3; // null null true
12 Console.WriteLine("[{0}] [{1}] [{2}]", b7, b8, b9);
13 Console.WriteLine(b1 != null ? "null is true" : "null is false"); // null is false
14 Console.WriteLine(b1 == null ? "!null is true" : "!null is false"); // !null is false
16 Console.WriteLine();
17 bool?[] bvals = new bool?[] { null, false, true };
18 Console.WriteLine("{0,-6} {1,-6} {2,-6} {3,-6} {4,-6}",
19 "x", "y", "x&y", "x|y", "x^y");
20 foreach (bool? x in bvals)
21 foreach (bool? y in bvals)
22 Console.WriteLine("{0,-6} {1,-6} {2,-6} {3,-6} {4,-6}",
23 x, y, x&y, x|y, x^y);
24 Console.WriteLine();
25 Console.WriteLine("{0,-6} {1,-6}", "x", "!x");
26 foreach (bool? x in bvals)
27 Console.WriteLine("{0,-6} {1,-6}", x, !x);