Skip to content

Commit

Permalink
Add is_unconstrained docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher committed Jul 5, 2024
1 parent b4eed93 commit 4285c10
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/docs/noir/standard_library/is_unconstrained.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,14 @@ pub fn external_interface(){

```

The is_unconstrained result is resolved at compile time, so in unconstrained contexts the compiler removes the else branch, and in constrained contexts the compiler removes the if branch, reducing the amount of compute necessary to run external_interface.
The is_unconstrained result is resolved at compile time, so in unconstrained contexts the compiler removes the else branch, and in constrained contexts the compiler removes the if branch, reducing the amount of compute necessary to run external_interface.

Note that using `is_unconstrained` in a `comptime` context will also return `true`:

```
fn main() {
comptime {
assert(is_unconstrained());
}
}
```

0 comments on commit 4285c10

Please sign in to comment.