# Implicit creation of an undefined out param variable. # The warnings generated below are intended to be a temporary situation class DefaultOut var _x = '' def main # User method x = .getX(true, out s0) assert x assert s0 == '.BigWalla' x =.getX(false, out s0) assert not x assert s0 == '.' s1 = 'something Ignored' x = .getX(true, out s1) assert x assert s1 =='.BigWalla' x =.getX(false, out s1) assert not x assert s1 == '.' # (nilable) variable in a system method d = {'a':'A1', 'b':'B2', 'c':'See3'} # result as String? x = d.tryGetValue('b', out result) assert x and result =='B2' x = d.tryGetValue('d', out result) assert not x and not result result = nil # out to a method Parameter r = '' .testParam(d, r) assert r == '' # out to a field assert _x == '' ok = d.tryGetValue('a', out _x) assert ok assert _x == 'A1' # out in an overloaded method successfully ok = int.tryParse('986', out iVal) # .warning. implicitly declared a variable assert ok assert iVal == 986 # out in an overloaded method unsuccessfully ok = int.tryParse('noway', out iVal1) # .warning. implicitly declared a variable assert not ok assert iVal1 == 0 def getX(flag as bool, z as out String) as bool z = '.' if flag z += 'BigWalla' return true return false def testParam(d as Dictionary, x as String) ok = d.tryGetValue('a', out x) assert ok assert x == 'A1'