The answer is: recursion. In true Functional Programming (which heavily features immutability), there are no loops. People throw around terms like "functional programming" and "immutability", but they rarely think about what it takes to fully implement these features.
Everything that you can do with a loop, you can also do with a recursive function. Here's a simple example:
The answer is: recursion. In true Functional Programming (which heavily features immutability), there are no loops. People throw around terms like "functional programming" and "immutability", but they rarely think about what it takes to fully implement these features.
Everything that you can do with a loop, you can also do with a recursive function. Here's a simple example:
Wow, thanks so much! This is exactly what I was looking for.