In calculation For Loop

Idea created by Vincent_L on Jan 31, 2016
    Active
    Score2
    • chivalry
    • Vincent_L

    Hi,

     

    90% of recursive functions are recursive as a way to loop. But recursion consumes lots of memory and is limited.

    Moreover, recursion is a tough concept, that  many users don't understand or even don't even heard about.

    Currently they're forced to learn it, just for the sake of looping.

     

    So, if, like the let implementation, have a " For i=1 to 50 steps 2 " functionality in calculations it would solves 90% of cases where todays recursion is used for. Moreover it would do it without any more memory consumption (unlike recursion), would be unlimited (but in a controlled way), and all user would be able to understand and master it.

     

    The reason I'm advocating for "for loop" instead of whiles, repeats-until, exit if, is that the for loop length is de facto limited. So it will always end. this is especially important in a calc or cf, because if you mess your exit test, you could get your solution bricked by infinite unwanted looping.

    With for loop there's no chances it could happen.

     

    I would allow us to get cleaner code, more of us (newbies) will benefit from it, less memory usage, un-limited but always in control cals of CF.