sync(
fn)
Execute a function inside a synchronized output block
Wraps fn in synchronized output mode escapes — all terminal
writes performed by fn are batched and flushed as a single
atomic screen update when the block ends. If fn raises an
error, the synchronized block is still properly closed before
the error is re-raised.