Skip to content

Indenting

We saw that the procedures body, was indented like in python. So, indenting is one way of creating code blocks. We can see a block of code highlighted in yellow in the next example:

proc example(val:int) = 
  # prints val plus 20
  let value = val + 20  
  echo value

example(10)

block statement

We can use block statement to create a code block:

block:
  echo "this is"
  echo "another block"

They can be labeled:

block yourname:
  echo "this is"
  echo "a block"

we will come back to labeled blocks when we talk about loops