class MultiAssign var _i0 as int var _i1 as int var x0 as String ='' var x1 as String ='' pro p0 from _i0 pro p1 from _i1 set [i as int] branch i on 0, .x0 = value on 1, .x1 = value else, throw ArgumentOutOfRangeException('[i] out of range 0,1') def main is shared ma = MultiAssign() ma.nonLocalVar ma.forIEnum ma.forIndexor ma.forSwap def nonLocalVar _i0, _i1 = [3,4] assert _i0 == 3 assert _i1 == 4 .x0, .x1 = ['03', '04'] assert .x0 == '03' assert .x1 == '04' .x0, .x1 = .methRetList2 assert .x0 == 'a' assert .x1 == 'b' s = this s.x0, s.x1 = ['031', '041'] assert .x0 == '031' assert .x1 == '041' .p0, .p1 = [910, 911] assert .p0 == 910 assert .p1 == 911 def methRetList2 as List return ['a', 'b'] def forIEnum list = [1, 2, 3, 4] a, b = for k in list where k < 3 get k assert a == 1 assert b == 2 def forIndexor this[0] = 'x' this[1] = 'y' assert .x0 == 'x' assert .x1 == 'y' this[0],this[1] = ['aa', 'bb'] assert .x0 == 'aa' assert .x1 == 'bb' tx = this tx[0], tx[1] = ['xa', 'xb'] assert .x0 == 'xa' assert .x1 == 'xb' def forSwap # common variable swap idiom (python a, b = b, a) a = 99 b = 100 a, b = [b, a] assert a == 100 assert b == 99