Void context

In a list of statements every expression except the last one needs to have the type void. In addition to this rule an assignment to the builtin result symbol also triggers a mandatory void context for the subsequent expressions:

  1. proc invalid*(): string =
  2. result = "foo"
  3. "invalid" # Error: value of type 'string' has to be discarded
  1. proc valid*(): string =
  2. let x = 317
  3. "valid"