git @ Cat's Eye Technologies Castile / master eg / typecase.castile
master

Tree @master (Download .tar.gz)

typecase.castile @masterraw · history · blame

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 */
}