1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
fun foo(a, b: integer|string) { r = a; typecase b is integer { r = r + b; }; typecase b is string { r = r + len(b); }; r } main = fun() { a = 0; a = foo(a, 333 as integer|string); a = foo(a, "hiya" as integer|string); a /* should output 337 */ }