Visit ComfyUI Online for ready-to-use ComfyUI environment
Interchange input values based on condition, toggle for swapping or keeping original order, offers flexibility in workflow.
The Swap node is designed to interchange the values of two inputs based on a specified condition. This node is particularly useful in scenarios where you need to dynamically switch between two data streams or values during the execution of a workflow. By providing a simple boolean toggle, the Swap node allows you to control whether the values should be swapped or remain in their original order. This functionality can be beneficial in various creative processes, such as altering the flow of data or modifying the sequence of operations, thereby offering flexibility and control over the execution path.
This parameter represents the first value to be considered for swapping. It can be of any data type, allowing for a wide range of inputs to be used. The impact of this parameter is directly related to the doSwap condition; if swapping is enabled, this value will be exchanged with val2.
Similar to val1, this parameter is the second value involved in the potential swap. It also accepts any data type, providing versatility in its application. The role of val2 is to be swapped with val1 when the doSwap condition is true.
This is a boolean parameter that determines whether the swap operation should occur. When set to true, the values of val1 and val2 are interchanged. If false, the values remain in their original order. This parameter is crucial for controlling the behavior of the node and allows for dynamic decision-making within a workflow.
This output represents the first value after the swap operation. If doSwap is true, valA will contain the original value of val2. If doSwap is false, valA will simply be the original val1.
This output corresponds to the second value post-swap. When doSwap is true, valB will hold the original value of val1. Conversely, if doSwap is false, valB will be the original val2. These outputs allow you to access the results of the swap operation and use them in subsequent nodes or processes.
doSwap parameter to dynamically control the flow of data in your workflow, enabling or disabling the swap based on specific conditions or triggers.val1 or val2 are not compatible with the expected data types.val1 and val2 are of compatible types or convert them to a common type before using the Swap node.doSwap parameter is not set to a valid boolean value.doSwap is explicitly set to either true or false to ensure proper operation of the node.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.