Tour: Swallowing

Block indentation makes sense for programming languages where you can often split up code into smaller parts if indentation gets too deep. But for the possibly long content Nyarna has been designed for, it doesn't always make sense – especially if the block takes up more than a whole screen.

Nyarna provides an alternate syntax that lets you write nested structured input on a single level: Swallowing. If you end a call's block list with “>” right after the starting colon, or after a block name, the command syntactically ends. All of the following content till the end of the surrounding block will be used as final argument to the call.

If you gave “>” right after the blocks start, this final argument will be used as primary block. If you gave it after a block name, the final argument will be used as the block with that name. You mustn't give an “\end(…)” structure for a call you have used swallowing on.

Before “>”, you may give decimal digits denoting a swallow depth. If you do, the swallowed content will alternatively end before a call that uses the same or a lesser swallow depth.

You can define a call parameter to be auto-swallowing. When you then call the entity with that parameter without an argument for that parameter, and without a block list, the following content will automatically be swallowed.