Skip to content

Commit

Permalink
chore(docs): Supplement descriptions for defaulting loop indices to b…
Browse files Browse the repository at this point in the history
…e `u64` (#3237)

Co-authored-by: José Pedro Sousa <[email protected]>
Co-authored-by: jfecher <[email protected]>
  • Loading branch information
3 people authored Oct 26, 2023
1 parent b45f3a1 commit d58f15e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docs/docs/language_concepts/data_types/01_integers.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ keywords:
An integer type is a range constrained field type. The Noir frontend currently supports unsigned,
arbitrary-sized integer types.

> **Note:** When an integer is defined in Noir without a specific type, it will default to `Field`. The one exception is for loop indices which default to `u64` since comparisons on `Field`s are not possible.
An integer type is specified first with the letter `u`, indicating its unsigned nature, followed by
its length in bits (e.g. `32`). For example, a `u32` variable can store a value in the range of
$\\([0,2^{32}-1]\\)$:
$\\([0,2^{32}-1]\\)$.

> **Note:** The default proving backend supports both even (e.g. `u16`, `u48`) and odd (e.g. `u5`, `u3`)
> sized integer types.
Taking a look of how the type is used:

```rust
fn main(x : Field, y : u32) {
Expand All @@ -28,6 +35,3 @@ fn main(x : Field, y : u32) {
`x`, `y` and `z` are all private values in this example. However, `x` is a field while `y` and `z`
are unsigned 32-bit integers. If `y` or `z` exceeds the range $\\([0,2^{32}-1]\\)$, proofs created
will be rejected by the verifier.

> **Note:** The default backend supports both even (e.g. `u16`, `u48`) and odd (e.g. `u5`, `u3`)
> sized integer types.

0 comments on commit d58f15e

Please sign in to comment.