Yieldable (Sequential) Iterator Int:
The YieldableIteratorInt node is designed to generate a sequence of integers in a specified range, allowing you to iterate through numbers sequentially with a defined start, end, and step value. This node is particularly useful when you need to cycle through a series of numbers repeatedly, as it automatically resets and starts over once it reaches the end of the specified range. The node's ability to reset ensures that it can be used in continuous loops without manual intervention, making it a powerful tool for tasks that require repeated numerical sequences. Its primary function is to yield integers one at a time, providing a simple yet effective way to manage sequential data in your workflows.
Yieldable (Sequential) Iterator Int Input Parameters:
start
The start parameter defines the initial value of the sequence. It determines where the iteration begins. The default value is 0, and it can range from -(2^63-1) to (2^63-1). This parameter is crucial as it sets the starting point of your sequence, impacting the first number yielded by the node.
end
The end parameter specifies the endpoint of the sequence, which is exclusive. This means the iteration will stop before reaching this value. The default is set to 10, with the same range as the start parameter. It is essential for defining the boundary of your sequence, ensuring that the iteration does not exceed this limit.
step
The step parameter determines the increment between each number in the sequence. By default, it is set to 1, allowing for a straightforward sequential progression. Like the other parameters, it can range from -(2^63-1) to (2^63-1). This parameter is vital for controlling the pace of the iteration, allowing for both forward and backward sequences depending on its value.
reset
The reset parameter is a boolean that, when set to True, resets the iterator to the beginning of the sequence. Its default value is False. This parameter is particularly useful for restarting the sequence without having to manually reinitialize the node, ensuring seamless looping through the sequence.
Yieldable (Sequential) Iterator Int Output Parameters:
INT
The output of the YieldableIteratorInt node is an integer (INT). This output represents the current value in the sequence generated by the node. Each call to the node's generate function yields the next integer in the sequence, providing a simple and effective way to access sequential numbers for use in various applications.
Yieldable (Sequential) Iterator Int Usage Tips:
- Use the
resetparameter to restart the sequence when needed, especially in loops where you want to cycle through the numbers repeatedly. - Adjust the
stepparameter to control the increment between numbers, allowing for both fine-grained and broad sequences depending on your needs.
Yieldable (Sequential) Iterator Int Common Errors and Solutions:
Iterator not initialized
- Explanation: This error occurs when the iterator is not properly initialized, possibly due to incorrect parameter values or a failure to reset.
- Solution: Ensure that the
start,end, andstepparameters are set correctly and use theresetparameter to reinitialize the iterator if necessary.
StopIteration exception
- Explanation: This exception is raised when the iterator reaches the end of the sequence and attempts to continue.
- Solution: The node is designed to handle this by resetting the iterator automatically. If this exception occurs, verify that the node's logic is correctly implemented and that the
resetparameter is used appropriately.
