# M0010 missing return (/docs/diagnostics/codes/m0010)

<Diagnostic code="M0010" />

## The mistake and the fix [#the-mistake-and-the-fix]

<div className="code-pair">

```go title="The mistake"
func sign(x int) int {
	if x < 0 {
		return -1
	}
}
```

```go title="Fixed"
func sign(x int) int {
	if x < 0 {
		return -1
	}
	return 1 // [!code highlight]
}
```

</div>

## The fix [#the-fix]

Add a return at the end, or a panic for a case that cannot happen.

See also [all error codes](/docs/diagnostics/codes) and [marmot explain](/docs/commands/explain).