Skip to content

Null handling

Jonathan edited this page Dec 28, 2017 · 1 revision

In firefly, there is no null value, instead you should use none when value is not present, to be able to allow a None value you should mark the type with ?. Theoritically None is a type that extends all other types.

Example:

fun hello(person: Person?) {
  if (person is None) {
    println("No person provided")
  } else {
    println(#{"Person name: {0}" where 0 -> person.name})
  }
}
Clone this wiki locally