013 js continuation branch dispatch

✓ Passing This code compiles and runs correctly.

Code

input.kz

Actual

even

Expected output

✓ Zig✓ JavaScript
even
Emitted JavaScript source
const main_module = {
  pick_event: {
    handler(input) {
      const n = input.n;
      if (n % 2 === 0) {
      return { tag: "even", even: "even" };
      }
      return { tag: "odd", odd: "odd" };
    },
  },
  print_event: {
    handler(input) {
      const text = input.text;
      process.stdout.write(text);
    },
  },
  flow0() {
    const result_0 = main_module.pick_event.handler({ n: 4 });
    if (result_0.tag === "even") {
      const e = result_0.even;
      main_module.print_event.handler({ text: e });
    }
    if (result_0.tag === "odd") {
      const o = result_0.odd;
      main_module.print_event.handler({ text: o });
    }
  },
};
main_module.flow0();

Test Configuration

MUST_RUN