✓
Passing This code compiles and runs correctly.
Code
// ~if template cross-target: its body lowers to `if(){}else{}`, valid in BOTH
// targets — so the template works on JS (unlike ~for, whose Zig for-loop syntax
// doesn't). Uses a literal condition to avoid the separate host-const-emission
// bug (see 140_010). PASSING here = templates are NOT Zig-only.
~import std/io
~if(42 > 10)
| then |> std/io:print("big\n")
| else |> std/io:print("small\n")
Actual
big
Expected output
✓ Zig✓ JavaScriptbig
Emitted JavaScript source
const main_module = {
flow0() {
if (42 > 10) {
{ process.stdout.write("big\n");
}
} else {
{ process.stdout.write("small\n");
}
}
},
};
main_module.flow0();
Flows
flow ~if click a branch to expand · @labels scroll to their anchor
if (42 > 10)
Test Configuration
MUST_RUN