# begin Evaluate a sequence of expressions in order, returning the value of the last one. Discards intermediate results.
[begin e1 e2 ... en]
`begin` is deft's explicit sequencing form. Multi-statement `{...}` blocks and multi-statement macro bodies are wrapped in `begin` by the parser, so you rarely write it directly. It's most useful inside `macro/quote`/`macro/syntax-quote` when a macro needs to emit a multi-step expansion as a single expression. ## Example
echo [begin 1 2 (3 + 4)]        # 7  — intermediates discarded

[begin [echo "step 1"] [echo "step 2"] 42] |> echo
# step 1
# step 2
# 42
## Inside macros When a quoted macro expansion needs multiple statements, wrap them in `begin`:
defmacro inc-and-return {|x|
    [macro/quote [begin [set $x ($x + 1)] $x]]
}

set n 5
echo [inc-and-return $n]        # 6
A multi-statement `{...}` block passed as a macro argument is already `begin`-wrapped by the parser, so `[macro/unquote $body]` inside a `macro/quote` just drops it in place — no extra `begin` needed. ## Notes - Empty `begin` (`[begin]`) returns nil. - `begin` itself is not in tail position — only its last sub-expression inherits the tail context of the surrounding form. - Used internally by `parseBlockBody` to wrap 2+ statements into a single AST node. ## See Also `defmacro`, `macro/quote`, `macro/syntax-quote`, `if`, `for`