# ensures

Declare a postcondition

Last updated: 2026-09-09

Package: language | Status: experimental

Tags: complete-program, cpu, functions, keyword, yeho

Use contracts at important boundaries where callers and maintainers need one visible definition of correctness.

```yh
ensures
```


## Contract pass

Use contracts at important boundaries where callers and maintainers need one visible definition of correctness.

Verification: type checked

```yh
Increment(int value) returns int
requires(value > 0)
ensures(result == value + 1)
{
    return value + 1
}

Console.Log(Text.From(Increment(4)))

```

Save this beside start.yh as project.mech:

```toml
package = "tests.compiler.errorsTasksEffects.contractPass"
version = "0.1.0"
backend = "cpu-oracle"
osTarget = "windows"
archTarget = "x64"
selfContainedApp = false

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/word--ensures/complete --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Errors and contracts are experimental in the current conformance edition.

Keep the condition deterministic and cheap enough to be useful as evidence.

Source: yeho/parser_declarations.cpp parseContractClauses and parseThingInvariant; conformance errors-contracts

AI training permission: https://demonhunterlabs.com/ai-use
