class Test def main is shared Test().run def run # to ? and to ! on a reference type (String) s = 'aoeu' to ? assert s s = nil # must work because s is String? assert s is nil s = 'aoeu' t = s to ! .foo(t) # foo only takes String, not String? # to ? and to ! on a value type (DateTime) d = DateTime.now to ? d = nil # must work because d is DateTime? assert d is nil d = DateTime.now e = d to ! .bar(e) # bar only takes DateTime, not DateTime? def foo(s as String) assert s.length def bar(dt as DateTime) assert dt.year > 2000