Nodes/ComfyUI-YogurtNodes/RangeItem (Yogurt Nodes)
ComfyUI Node

RangeItem (Yogurt Nodes)

Grab One Value Out of a Range

By yogurt7771·Created 2 years ago·Updated 4 days ago· 1
RangeItem (Yogurt Nodes)
  • range
  • string
  • int
  • float
index0

YogurtRangeItem is the "give me just one number from a list of numbers" node. You hand it a range and an index, and it hands back a single value in three convenient flavors: string, int, and float. One output will be useful, and you pick whichever matches what's waiting downstream.

Two inputs, both simple:

  • range - the list of values. Defaults to [0, 1, 0.1], and it accepts a plain list or a RANGE from the pack's own YogurtRange node.
  • index - which value to return. 0 is the first value, and negative indices count from the end, so -1 grabs the last one.

The negative-index bit is the feature people forget. In a sweep loop driven by a batch count, the last value is almost always the "final" run you care about, and -1 gets it without you needing to know the list length.

How you'll actually use it

It pairs with YogurtRange the way a for-loop pairs with its range: YogurtRange builds the list, YogurtRangeItem picks an entry. Common patterns:

  • A "current strength" value for a LoRA in a sweep - YogurtRange supplies the series, YogurtRangeItem feeds one value into the run.
  • A seed or config picker where you have a short list and a selector index from elsewhere in the graph.
  • Pulling a value by negative index for "the last one" without hardcoding a position.

The three output types exist so you don't have to convert. If the downstream node wants a FLOAT, use float; if it's comparing against an INT, use int. The conversion is done for you, which saves a String To Number detour in most cases.

Install

Ships in ComfyUI-YogurtNodes, same as its sibling. ComfyUI Manager → search ComfyUI-YogurtNodes → install, or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt

Restart ComfyUI, find it under "Yogurt Nodes" (the "(Yogurt Nodes)" suffix is part of the display name).

The only gotcha is thinking it's smarter than it is. The index is a plain number lookup - there's no clamping and no "closest value" logic. Ask for index 50 in a 10-item list and you'll get an out-of-range error, so keep your index within bounds or drive it from something that already knows the length (that's what YogurtRange's count output is for).

CategoryYogurtNodes/Number

Inputs (2)

NameTypeDefaultDescription
rangeLIST0,1,0.1
indexINT0index of the value to return, 0 means first value, negative means last value

Outputs (3)

NameTypeDescription
stringSTRING
intINT
floatFLOAT