class OptParam def main is shared x = OptParam() x.call = 0 x.foo assert x.call ==1 x.foo(10) assert x.call == 10 var call = 0 def foo(i as int = 1) # optional single param print i .call = i