✓
Passing This code compiles and runs correctly.
Code
// Cross-target print interpolation. A `{{ expr:d }}` in print.ln lowers to a
// format arg on Zig and a parenthesized string-concat operand on JS. Pins that
// a MULTI-TERM interpolation expression (`40 + 2`) is emitted as ONE operand on
// the JS side — `"answer = " + (40 + 2)` = "answer = 42", never the
// left-to-right fold `"answer = " + 40 + 2` = "answer = 402". Same source, same
// output, two backends.
~import std/io
~std/io:print.ln("answer = {{ 40 + 2:d }}")
Actual
answer = 42
Expected output
✓ Zig✓ JavaScriptanswer = 42
Emitted JavaScript source
const main_module = {
flow0() {
process.stdout.write("answer = " + (40 + 2) + "\n");
},
};
main_module.flow0();
Flows
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "answer = {{ 40 + 2:d }}")
Test Configuration
MUST_RUN