ComfyUI > Nodes > Bjornulf_custom_nodes > 🔀 If-Else (input / compare_with)

ComfyUI Node: 🔀 If-Else (input / compare_with)

Class Name

Bjornulf_IfElse

Category
Bjornulf
Author
justUmen (Account age: 3046days)
Extension
Bjornulf_custom_nodes
Latest Updated
2025-02-28
Github Stars
0.2K

How to Install Bjornulf_custom_nodes

Install this extension via the ComfyUI Manager by searching for Bjornulf_custom_nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Bjornulf_custom_nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

🔀 If-Else (input / compare_with) Description

Facilitates conditional logic for AI art workflows, enabling decision-making based on specified conditions.

🔀 If-Else (input / compare_with):

The Bjornulf_IfElse node is designed to facilitate conditional logic within your AI art workflows, allowing you to execute different actions based on the evaluation of a condition. This node acts as a decision-making tool, where you can specify a condition and determine what should happen if the condition is true or false. It supports various types of comparisons, including string equality, boolean checks, and numeric comparisons, making it versatile for different scenarios. By using this node, you can streamline your processes by automating decisions, which can lead to more dynamic and responsive art generation workflows. The node's primary function is to evaluate the given condition and return specified outputs based on the result, thus providing a flexible mechanism to control the flow of your creative projects.

🔀 If-Else (input / compare_with) Input Parameters:

input

The input parameter is the primary value that you want to evaluate against a condition. It can be of any type, such as a string, number, or boolean, depending on the comparison you wish to perform. This parameter is crucial as it determines the outcome of the conditional logic applied by the node.

input_type

The input_type parameter specifies the type of comparison to be performed between the input and compare_with values. It offers several options, including string equality, boolean checks, and numeric comparisons like greater than or less than. The default value is "STRING: input EQUAL TO compare_with". This parameter dictates how the node interprets the input and compare_with values, thus affecting the result of the condition.

send_if_true

The send_if_true parameter defines the output that will be returned if the condition evaluates to true. This can be any value or object that you want to pass along in your workflow when the specified condition is met. It is essential for determining the path your workflow will take when the condition is satisfied.

compare_with

The compare_with parameter is the value against which the input is compared. It must be compatible with the input type and the specified input_type comparison. This parameter is integral to the conditional logic, as it serves as the benchmark for evaluating the input.

send_if_false

The send_if_false parameter is an optional value that will be returned if the condition evaluates to false. Like send_if_true, it can be any value or object, and it determines the alternative path your workflow will take when the condition is not met.

🔀 If-Else (input / compare_with) Output Parameters:

output

The output parameter is the result returned by the node when the condition evaluates to true. It corresponds to the send_if_true input and represents the successful path of the conditional logic.

rejected

The rejected parameter is the result returned by the node when the condition evaluates to false. It corresponds to the send_if_false input, or send_if_true if send_if_false is not provided, representing the alternative path of the conditional logic.

input_type

The input_type output provides a string representation of the type of comparison that was performed. This can be useful for debugging or logging purposes, as it indicates how the input and compare_with values were evaluated.

true_or_false

The true_or_false output is a string that indicates the result of the condition evaluation, either "True" or "False". This output is useful for understanding the outcome of the conditional logic.

details

The details output provides a comprehensive string containing information about the evaluation process, including the inputs, comparison type, and result. This can be valuable for debugging or for gaining insights into how the node reached its decision.

🔀 If-Else (input / compare_with) Usage Tips:

  • Ensure that the input and compare_with values are compatible with the specified input_type to avoid unexpected results.
  • Use the details output to gain insights into the evaluation process, which can help in debugging and understanding the node's behavior.
  • Consider providing a send_if_false value to handle cases where the condition is not met, ensuring that your workflow can proceed smoothly in either scenario.

🔀 If-Else (input / compare_with) Common Errors and Solutions:

If-Else ERROR: For numeric comparisons, both "input" and "compare_with" must be valid numbers.

  • Explanation: This error occurs when the input or compare_with values are not valid numbers, but a numeric comparison is specified.
  • Solution: Ensure that both input and compare_with are valid numeric values when using numeric comparison types.

If-Else ERROR: For boolean check, "input" must be a recognizable boolean value.

  • Explanation: This error arises when the input value is not a recognizable boolean value, but a boolean check is specified.
  • Solution: Make sure the input is a valid boolean representation, such as "true", "false", "1", "0", "yes", "no", "y", "n", "on", or "off".

🔀 If-Else (input / compare_with) Related Nodes

Go back to the extension to check out more related nodes.
Bjornulf_custom_nodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.