✓
Passing This code compiles and runs correctly.
Code
// NOTE: narrowed to Zig — print.ln of a bare variable WITH newline has no JS
// variant yet (print.ln is a Zig comptime transform; std/io:print has |js but no
// newline). print.ln cross-target JS for variable args is a tracked gap.
// JS continuation-branch dispatch: the JS emitter switches on the returned
// branch tag (as Zig does), firing only the matched branch — not all of them.
// n=4 → only the `even` branch fires; byte-identical on both targets. Minimal,
// no std/args dependency.
~import std/io
~tor pick { n: i32 }
| even string
| odd string
~proc pick|zig {
if (@mod(n, 2) == 0) {
return .{ .even = "even" };
}
return .{ .odd = "odd" };
}
~proc pick|js {
if (n % 2 === 0) {
return { tag: "even", even: "even" };
}
return { tag: "odd", odd: "odd" };
}
~pick(n: 4)
| even e |> std/io:print.ln(e)
| odd o |> std/io:print.ln(o)
Actual
even
Expected output
even
Flows
flow ~pick click a branch to expand · @labels scroll to their anchor
pick (n: 4)
Test Configuration
MUST_RUN