Hash :
0791e752
Author :
Thomas de Grivel
Date :
2025-04-02T17:38:27
doc: block
A KC3 block is a source code block. It starts with do or { and
ends with end or } respectively.
It can be passed to a special operator or macro function to
be evaluated explicitly in C with env_eval_block (see
libkc3/env_eval.c).
A block evaluates all its instructions in turn, and returns the value of the last expression.
ikc3> do
ikc3> 1
ikc3> 2
ikc3> 3
ikc3> end
3
ikc3> quote do
ikc3> 1
ikc3> 2
ikc3> 3
ikc3> end
do
1
2
3
end
ikc3> type(quote do
ikc3> 1
ikc3> 2
ikc3> 3
ikc3> end)
Block
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
# 1.9 Block
A KC3 block is a source code block. It starts with `do` or `{` and
ends with `end` or `}` respectively.
It can be passed to a special operator or macro function to
be evaluated explicitly in C with `env_eval_block` (see
`libkc3/env_eval.c`).
A block evaluates all its instructions in turn, and returns the value
of the last expression.
## 1.9.1 Examples
```elixir
ikc3> do
ikc3> 1
ikc3> 2
ikc3> 3
ikc3> end
3
ikc3> quote do
ikc3> 1
ikc3> 2
ikc3> 3
ikc3> end
do
1
2
3
end
ikc3> type(quote do
ikc3> 1
ikc3> 2
ikc3> 3
ikc3> end)
Block
```