# 0110: Function must return N values

Compiler found that number of values in return statement does not match [function signature](/language/functions.md#signature). It can happen if `return` has more or fewer values.

For example, if function has not declared any return type, it's incorrect to return values from it:

```pascal
function foo
  return 1 // error, `foo` should return nothing
end
```

Similarly, it is incorrect to return nothing, when the function has declared a return type:

```pascal
function bar: int
  return
end
```

#### Possible solutions:

* check a number of returned values following a `return` keyword. Make sure this number matches the number of return types declared in the function's signature
* if the function may, under some condition, return nothing ([a fallible function](/language/functions.md#optional-return-type)), its return type must be prepended with an `optional` keyword:

```pascal
function bar: optional int
  if ...
  then
    return 1
  else
   return
  end
end
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sannybuilder.com/troubleshooting/errors/0110.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
