kc3-lang/kc3/doc/1_KC3/1.09_Block.en.md

Download

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

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

Source

Download