1.3 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.3.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

Top : KC3 documentation

Previous : 1.02 Array

Next : 1.04 Bool