class Test shared def main assert .join('', [1, 2, 3]) == '123' assert .join(' ', ['a', 'b', 'c']) == 'a b c' assert .same(5) == 5 assert .same(Test) == Test Test().run # test generic methods that aren't shared def join(separator as String, stuff as IEnumerable) as String sb = StringBuilder() sep = '' for item in stuff sb.append(sep) sb.append(if(item is nil, 'nil', item.toString)) # use the CobraImp or CobraCore.toString() sep = separator return sb.toString def same(t as T) as T # test return value x as T = t # use generic type in body return x def run i = 5 j = 6 .take2(i, j) .swap(inout i, inout j) assert i == 6 and j == 5 def take2(a as T, b as T) pass def swap(a as inout T, b as inout T) # generic method with inout args tmp = a a = b b = tmp