Scripting: Recursion

From Waltz
Jump to navigation Jump to search

Recursion in Waltz can occur accidentally when you create a cyclical reference to a node or value. Imagine creating a circle of node connections that eventually will ask for the exact value Waltz is currently trying to calculate, while it is trying to calculate the value. Because recursion in traditional computer science contexts can bring an application to a full halt, Waltz employs protections to prevent recursing while executing nodes. If at any time a cyclical reference is detected, Waltz stops attempting to execute the current script for a value, and instead returns a special <RecursiveReference!> object. This object can not be used for anything, but indicates that while trying to calculate a value, the very value that Waltz was trying to calculate is needed to complete the calculation.

If you believe you have encountered an issue that is incorrectly being characterized as recursion, please contact support.

Expressions and Scripting
Concepts Script Expressions · JavaScript
Fundamentals Constructors · Functions · Grammar · Operations · Outputs · Parameters · Referencing Nodes
Advanced Topics Flow Control · Consumer Functions · Loops and Iterations · Reference Chains
Errors Recursion · Script Exceptions · Syntax Errors · Try and Catch