range:
The DataListRange node is designed to generate a sequence of numbers, similar to Python's built-in range() function. This node is particularly useful for creating lists of integers that follow a specific pattern defined by the user. By specifying the starting point, ending point, and the step size, you can create a wide variety of numerical sequences. This functionality is beneficial for tasks that require iteration over a set of numbers or when you need to generate a predictable series of values for further processing. The node's ability to handle both positive and negative steps allows for flexible sequence generation, including counting up, counting down, and skipping numbers as needed.
range Input Parameters:
start
The start parameter defines the beginning of the sequence. It is an integer value that sets the first number in the generated list. By default, this value is set to 0. Adjusting the start value allows you to shift the entire sequence forward or backward on the number line. There is no explicit minimum or maximum value, but it should be within the range of typical integer values.
stop
The stop parameter specifies the endpoint of the sequence. The sequence will include numbers up to, but not including, this value. It is an integer and defaults to 10. The stop value determines the length of the sequence and is crucial for defining when the sequence should terminate.
step
The step parameter determines the increment between each number in the sequence. It is an optional integer parameter with a default value of 1. A positive step results in an ascending sequence, while a negative step creates a descending sequence. The step value must not be zero, as this would result in an infinite loop, and attempting to set it to zero will raise an error.
range Output Parameters:
INT
The output is a list of integers, represented as INT, which contains the sequence of numbers generated based on the specified start, stop, and step parameters. This list is the primary output of the node and can be used in subsequent operations that require a series of numbers.
range Usage Tips:
- Use a positive
stepto create an ascending sequence and a negativestepfor a descending sequence. - Ensure that the
startandstopvalues are set appropriately to avoid generating an empty list, especially when using a positivestepwithstartgreater thanstop. - Remember that the
stopvalue is exclusive, meaning the sequence will not include this number.
range Common Errors and Solutions:
Step cannot be zero
- Explanation: The
stepparameter was set to zero, which is not allowed as it would create an infinite loop. - Solution: Ensure that the
stepparameter is set to a non-zero integer value to define the increment between numbers in the sequence.
