--- title: Foreign result writeback description: Execute a foreign code fence and persist the result into this .mq.md import foreign:lib/foreign.mq.md import writeback:lib/writeback.mq.md --- # main This is a runnable example, not a screenshot. Run it with: ```text marqdo run examples/foreign-writeback/index.mq.md ``` The foreign fence below is a normal Marqdo code value. `foreign.run` executes it; `writeback.record` writes the result into a keyed output slot immediately below the call. Re-running replaces only the `total` slot. `合计代码` = ```python print(950) ``` **结果 = > foreign.run code=`合计代码`** **> writeback.record value=`结果` key="total"** The keyed slot below is generated by the run: 查看源码,确认 `total` 槽位就在这次 writeback 调用下方。