> ## Documentation Index
> Fetch the complete documentation index at: https://helix-digitalocean.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# E651

# Non-Iterable Variable

## Erroneous Code Example

This error occurs when you try to use a non-iterable variable in an iteration context.

In this example, the parameter `name` is not a collection, so it cannot be used in an iteration context.

<CodeGroup>
  ```rust queries.hx theme={null}
  Query addUser(name: String) =>
      FOR n IN name {
          AddN<User>({name: n})
      }
      RETURN "User added"
  ```
</CodeGroup>

## Solution

Ensure variables used in iterations are collections or arrays.

<CodeGroup>
  ```rust queries.hx theme={null}
  Query addUser(names: [String]) =>
      FOR n IN names {
          AddN<User>({name: n})
      }
      RETURN "Users added"
  ```
</CodeGroup>
