fork download
  1. Module mainModule
  2. Sub Main()
  3.  
  4. Dim s1 As String = Nothing
  5. If (s1 = Nothing) Then
  6. Call Console.WriteLine("String の Nothing は Nothing と等しいです。")
  7. Else
  8. Call Console.WriteLine("String の Nothing は Nothing と等しくありません。")
  9. End If
  10.  
  11. Dim s2 As String = String.Empty
  12. If (s2 = Nothing) Then
  13. Call Console.WriteLine("String.Empty は Nothing と等しいです。")
  14. Else
  15. Call Console.WriteLine("String.Empty は Nothing と等しくありません。")
  16. End If
  17.  
  18. Dim n1 As Integer = 0
  19. If (n1 = Nothing) Then
  20. Call Console.WriteLine("Integer の 0 は Nothing と等しいです。")
  21. Else
  22. Call Console.WriteLine("Integer の 0 は Nothing と等しくありません。")
  23. End If
  24.  
  25. Dim n2 As Integer = 1
  26. If (n2 = Nothing) Then
  27. Call Console.WriteLine("Integer の 1 は Nothing と等しいです。")
  28. Else
  29. Call Console.WriteLine("Integer の 1 は Nothing と等しくありません。")
  30. End If
  31.  
  32. Dim d1 As DateTime = DateTime.Today
  33. If (d1 = Nothing) Then
  34. Call Console.WriteLine("DateTime.Today は Nothing と等しいです。")
  35. Else
  36. Call Console.WriteLine("DateTime.Today は Nothing と等しくありません。")
  37. End If
  38.  
  39. Dim d2 As DateTime = New DateTime()
  40. If (d2 = Nothing) Then
  41. Call Console.WriteLine("New DateTime() は Nothing と等しいです。")
  42. Else
  43. Call Console.WriteLine("New DateTime() は Nothing と等しくありません。")
  44. End If
  45.  
  46. End Sub
  47. End Module
Success #stdin #stdout 0.08s 25664KB
stdin
Standard input is empty
stdout
String の Nothing は Nothing と等しいです。
String.Empty は Nothing と等しいです。
Integer の 0 は Nothing と等しいです。
Integer の 1 は Nothing と等しくありません。
DateTime.Today は Nothing と等しくありません。
New DateTime() は Nothing と等しいです。