.. _flow_control-feedback: Feedback -------- .. warning:: This feature is still experimental. Please report issues and use cases on the :ref:`support-forum` You can use ``Feedback`` connections as a simple why to take values from nodes at the end of the workflow and bring them back to nodes at the beginning of the workflow, effectively creating a feedback loop without using a :ref:`flow_control-loop` with ``Shift`` terminals. To mark a ``Connection`` as ``Feedback connection``, ``right-click`` the connection that you want to use as the feedback and select ``Feedback connection``. The connection will now be dashed instead of solid. .. figure:: ./images/feedback.png :align: center :width: 400 The sheet can now be run by pressing the |play| button. Every time the |play| button is pressed, one iteration will complete. To automatically run the sheet, press the |repeat| button. Press the |repeat| button again to stop iterating. .. figure:: ./images/feedback.gif :align: center :width: 400 How it works ++++++++++++ When a connection is marked as a ``Feedback connection``, the connection is removed from the `topological sort`_ and will not impact the order that the nodes are executed in. However, when a node is executed, it will still try to update the ``Feedback connection`` and use the value from the terminal of the node that it is connected to. Not all nodes can support this feature because on the first execution of the sheet, the value from the ``Feedback connection`` could be undefined. Nodes need to be either able to operate on (ignore) bad values or the value of the ``Feedback connection`` needs to be initialized to something that can be used. For example, in the above workflow, the ``result`` terminals of the ``Sum`` nodes are initialized to ``0``. On the first execution of the sheet, the ``Feedback connection`` has a value of ``0``, which is an acceptable value that the ``Sum`` node can operate on. .. _topological sort: https://en.wikipedia.org/wiki/Topological_sorting .. |play| image:: ../../../nodeworks/images/play.svg .. |repeat| image:: ../../../nodeworks/images/repeat.svg