class OptParam def main is shared x = OptParam() assert x.val ==0 and x.isOn == false x.isOn = true x.foo('this') assert x.val ==1 and x.isOn == false x.isOn = true x.foo('is', 10) assert x.val == 10 and x.isOn == false x.foo('sparta', 20, true) assert x.val == 20 and x.isOn == true var val = 0 var isOn = false def foo(s as String, i as int = 1, isOn as bool = false) .val = i .isOn = isOn