Null object: Difference between revisions

Scala.
(Added DWScript)
(Scala.)
Line 755:
<lang ruby>
puts "object is null" if object.nil?
</lang>
 
=={{header|Scala}}==
[http://blog.sanaulla.info/2009/07/12/nothingness/ This blog post] has a good explanations of the different types of null-like values.
 
<lang scala>
scala> Nil
res0: scala.collection.immutable.Nil.type = List()
 
scala> Nil == List()
res1: Boolean = true
 
scala> Null
<console>:8: error: not found: value Null
Null
^
 
scala> null
res3: Null = null
 
scala> None
res4: None.type = None
 
scala> Unit
res5: Unit.type = object scala.Unit
 
scala> val a = println()
a: Unit = ()
</lang>
 
Anonymous user