class Test var _c as Counter? def main is shared Test().run def inc(c as Counter) c.count = c.count + 1 def run .testLocal .testClassVar def testLocal c as Counter? # the key here is that the calls to .inc() are accepted even # though its parameter type is Counter not Counter? if c .inc(c) assert c is nil c = Counter() if c .inc(c) assert c.count==1 if c is not nil .inc(c) assert c.count==2 if c<>nil .inc(c) assert c.count==3 def testClassVar assert _c is nil if _c .inc(_c) _c = Counter() if _c .inc(_c) assert _c.count==1 if _c is not nil .inc(_c) assert _c.count==2 if _c<>nil .inc(_c) assert _c.count==3 class Counter var _count as int = 0 pro count from var