1.

Explain the difference between the terms Nil, Null, None and Nothing.

Answer»

Null, null, Nil, Nothing, None, and Unit are all used to represent empty values in Scala.   

  • Null refers to the absence of data, and its type is Null with a capital N.  
  • Null is considered to be a list that contains zero ITEMS. Essentially, it indicates the END of the list.  
  • Nothing is also a trait WITHOUT instances.   
  • None represents a sensible return VALUE
  • Unit is the return type for functions that return no value. 


Discussion

No Comment Found