Cheatsheet: Data Structures
    Array / List
    Map / Dict
    Set
    Tuple
    Struct / Data Class
    Stacks
    Other Data Structures
    Collection Conversions
Cheatsheet: Control Flow
Cheatsheet: Class

Polyglot CheatSheet - None/Null/Nil

Updated: 2022-04-25

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