> For the complete documentation index, see [llms.txt](https://musicq.gitbook.io/unwrapit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://musicq.gitbook.io/unwrapit/recipe/return-result-without-wrap-it.md).

# Return Result Without \`wrap\` it

In some cases, you might want to define your own logic to determine whether to return an `ok` value or `err` value. You can do this by using [`ok`](/unwrapit/apis/ok.md) and [`err`](/unwrapit/apis/err.md) API.

```typescript
import {ok, err, type Result} from 'unwrapit'

export function addNumber(a: number, b: number): Result<number, string> {
    if (a < b) {
        return err('a should greater than b')
    }
    
    if (a === b) {
        return err("a shouldn't equal to b")
    }
    
    return ok(a + b)
}
```
