fork download
  1. using System;
  2. using System.Globalization;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5.  
  6. public class Test
  7. {
  8.  
  9.  
  10. public static void Main()
  11. {
  12. double? previousValue = null;
  13. double? v1 = 1 + previousValue ?? 0;
  14. double? v2 = 1 + (previousValue ?? 0);
  15. Console.WriteLine("V1.Hasvalue? {0} V1.Value:{1}",v1.HasValue, v1.Value);
  16. Console.WriteLine("V2.Hasvalue? {0} V2.Value:{1}",v2.HasValue, v2.Value);
  17. }
  18. }
Success #stdin #stdout 0.03s 33928KB
stdin
Standard input is empty
stdout
V1.Hasvalue? True V1.Value:0
V2.Hasvalue? True V2.Value:1