Optional Types - brombres/Rogue GitHub Wiki

Syntax

local x : Int32?
println x         # null
println x.exists  # false
x = 5
println x         # 5
println x.exists  # true
println x?        # true
if (x) println x.value  # 5
x = null

...
method locate( word:String )->Int32?
  forEach (i of words)
    if (words[i] == word) return i
  endForEach
  return null  # not found

local result = locate( word )
if (result) do_stuff(...)