diff --git a/README.md b/README.md index 8b55f8e..df87d1f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This allows you to repeat execution steps by outputting a list of integers, whic ## Features - **For Loop (Count)**: Simple loop that runs `N` times. outputs `0` to `N-1`. -- **For Loop (Range)**: Loop based on python `range(start, stop, step)`. +- **For Loop (Range)**: Loop based on python `range(start, stop, step)` (negative values and descending loops supported, except `step=0`). ## Installation diff --git a/loop_node.py b/loop_node.py index 9037ecd..d665c78 100644 --- a/loop_node.py +++ b/loop_node.py @@ -28,9 +28,9 @@ class SimpleForLoopRange: def INPUT_TYPES(s): return { "required": { - "start": ("INT", {"default": 0, "min": 0, "max": 10000, "step": 1}), - "stop": ("INT", {"default": 10, "min": 0, "max": 10000, "step": 1}), - "step": ("INT", {"default": 1, "min": 1, "max": 10000, "step": 1}), + "start": ("INT", {"default": 0, "min": -10000, "max": 10000, "step": 1}), + "stop": ("INT", {"default": 10, "min": -10000, "max": 10000, "step": 1}), + "step": ("INT", {"default": 1, "min": -10000, "max": 10000, "step": 1}), } } @@ -41,5 +41,7 @@ class SimpleForLoopRange: CATEGORY = "Loop" def execute(self, start, stop, step): + if step == 0: + raise ValueError("step must not be 0") range_vals = list(range(start, stop, step)) return (range_vals,)