Non-Nullable Types

Iodine extends the language with nullability annotations, matching the syntax we also use for C#. Reference types – which are nullable by default – can be marked as not nullable by suffixing the type name with an exclamation point (!), and value types can be marked as nullable with a question mark (?).

This can make for more robust code, as variables, fields, properties or parameters declared as such can be relied on to not be null.

Int32 i1;                       // non-nullable by default, 0
Button b1;                      // nullable by default, null

Int32? i2;                      // nullable, null
Button! b2 = new Button();      // not nullable, thus needs initialization

Please refer to the Nullability topic in the Language Concepts section for more detailed coverage.