Hash :
30c9375b
Author :
Thomas de Grivel
Date :
2025-05-05T10:16:18
block in functions
In KC3, a named block is a macro that allows you to do debranching returns.
First you create a block using block :name do ... end, then using
return or return_from :name you can return an abitrary value from
the block, expressions after return are not executed.
In the case where two blocks have the same name, the most inner block
is selected for return.
ikc3> block :abc do
ikc3> return 1
ikc3> 123
ikc3> end
1
ikc3> block :abc do
ikc3> return_from :abc 1 + 1
ikc3> 123
ikc3> end
2
Top : KC3 documentation
Previous : 1.25 Facts
Next : 2 HTTPd
# 1.26 Named block
In KC3, a named block is a macro that allows you to do debranching returns.
First you create a block using `block :name do ... end`, then using
`return` or `return_from :name` you can return an abitrary value from
the block, expressions after return are not executed.
In the case where two blocks have the same name, the most inner block
is selected for `return`.
## 1.26.1 Examples
```elixir
ikc3> block :abc do
ikc3> return 1
ikc3> 123
ikc3> end
1
ikc3> block :abc do
ikc3> return_from :abc 1 + 1
ikc3> 123
ikc3> end
2
```
---
Top : [KC3 documentation](/doc/)
Previous : [1.25 Facts](1.25_Facts)
Next : [2 HTTPd](../2_HTTPd)