logo

Programming Languages - None/Null/Nil

Last Updated: 2024-01-21

C++

Introduced in C++11:

nullptr

Java

null

Scala

  • Null: a Trait.
  • null: an instance of Null
  • Nil: an empty List of anything of zero length. It refers to List which has no contents(not "refers to nothing")
  • Nothing: a Trait; a subtype of everything; not superclass of anything; no instances of Nothing.
  • None: a sensible return value to avoid null pointer exception. One of 2 subclasses of Option, the other is Some.
  • Unit– Type of method that doesn’t return a value of any sort.

JavaScript

  • undefined
  • null

Ruby

nil

Python

None

Rust

None