I want to iterate over a function g with iterate. When I run my code the loop runs infinitely. Is there any possibility to get out of the loop when a condition is met?
Something like if g x > 100 then stop.
My code:
f x = iterate g x
g x = 2 * x