ComfyUI Node

AOrBGate

Combine two conditions into one clean boolean

By aria1th·Created 3 years ago·Updated 7 months ago· 119
AOrBGate
  • input1
  • input2
  • BOOLEAN

Shows up in the node picker as AOrBGate, and does exactly what that name promises: takes two values, checks if either one is truthy, and gives you back a clean BOOLEAN you can wire into a switch or a conditional step further down the graph.

What it does

Two required inputs, input1 and input2, both typed * (wildcard) with a default of 0. Unlike the bitwise Or elsewhere in this pack - which works strictly on integers and returns a number you have to interpret - this is a real logical OR: it evaluates the truthiness of both inputs (Python's usual rules apply - zero, empty strings, empty lists, and None are all falsy; basically everything else is truthy) and returns True if either one is truthy, False only if both are falsy. The output is genuinely BOOLEAN, locked to true/false, not a number pretending to be one.

Because both input ports are wildcard, you can feed it two completely different kinds of values - the result of a Compare node next to a raw string from somewhere else in the graph, say - and it'll still evaluate each on its own truthiness rather than requiring them to match types. That's useful for exactly the case it's built for: normalizing two different conditions from two different parts of a workflow into a single boolean you can act on, without needing an intermediate conversion step for each one.

The inputs and outputs that matter

  • input1 (required, any type, default 0) - the first condition.
  • input2 (required, any type, default 0) - the second condition.
  • Output: BOOLEAN - True if either input is truthy.

Installing it

Search ComfyUI-LogicUtils in ComfyUI Manager - again, the pack title, since this node's own display name (AOrBGate) won't be what shows up if you search the wrong string. Install, restart, or clone by hand: cd ComfyUI/custom_nodes && git clone https://github.com/aria1th/ComfyUI-LogicUtils, then restart ComfyUI. No models, no dependency weight to speak of - a Reddit thread specifically recommended this pack for its lack of dependencies when comparing lightweight logic-node options against heavier packs. There's an install hook behind COMFYUI_LOGICUTILS_AUTO_INSTALL=1 (opt-in) and COMFYUI_LOGICUTILS_SKIP_INSTALL=1 (force off); with nothing heavy here, most people never need either.

Where people get burned

The main thing to keep straight is which "Or" you're reaching for. This pack also has a Bitwise Or, and the two look similar at a glance in the node list but behave very differently - Bitwise Or works on raw integers and returns a number, this one works on truthiness and returns an actual boolean. If your goal is "is either of these conditions true," this is the node; if you're intentionally doing bit-level flag combination, you want the bitwise one instead.

The other thing worth knowing: because the inputs are wildcard, this node will happily accept and evaluate the truthiness of things that might not be obviously true or false at a glance - an empty list is falsy, a list containing one False value is still truthy (because the list itself isn't empty), a string "False" is truthy (because it's a non-empty string, regardless of what it says). If a result looks wrong, check what's actually flowing into the port rather than assuming the label or apparent value tells the whole story - Python's truthiness rules, not the surface appearance of the value, decide the outcome.

CategoryLogic Gates

Inputs (2)

NameTypeDefaultDescription
input1*0
input2*0

Outputs (1)

NameTypeDescription
BOOLEANBOOLEAN