Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

E633

For the complete documentation index optimized for AI agents, see llms.txt.

Non-Integer Range Index

Erroneous Code Example

This error occurs when you use a non-integer value as an index in a range operation.

In this example, the range index is a float value.

Query getUser() =>
    subset_of_users <- N<User>::RANGE(1.5, 4.9)
    RETURN subset_of_users
Query getUser(end: F32) =>
    subset_of_users <- N<User>::RANGE(0, end)
    RETURN subset_of_users

Solution

Use integer values for range indices or set variable types to integer types.

Query getUser() =>
    subset_of_users <- N<User>::RANGE(1, 5)
    RETURN subset_of_users
Query getUser(end: I64) =>
    subset_of_users <- N<User>::RANGE(0, end)
    RETURN subset_of_users