Skip to main content

Item Number In

Returns the element corresponding to the item number.

Item Number In block

Description

The Item Number In block returns the element corresponding to the item number. This is a code block part of the Lists drawer.

Usage

Use Item Number In to retrieve a specific element from a list by its position. This is essential for accessing list elements in loops, retrieving values at calculated positions, or working with parallel lists where indices correspond across multiple lists.

Syntax

Inputs:

  • A number (the index/item number)
  • A list to retrieve from

Notes

  • Returns the element at the specified position in the list
  • List indices in StarLogo Nova start at 1 (first element is at position 1)
  • Returns an error if the index is out of bounds
  • Can retrieve any type of element stored in the list
  • Index of in - Returns the position of an element in a list
  • List - Creates a list with specified elements
  • Length of - Returns the number of items in a list
  • Contains - Checks if an element exists in a list