Skip to main content
Known Participant
Jul 19, 2022 6:17 PM UTC
Question

Foreach decrementation

how to print fv!index in reverse order in foreach loop.

E.g 5,4,3,2,1

    2 replies

    mikes0011
    Brainy
    Jul 19, 2022 6:41 PM UTC

    Since you didn't specify any use case or requirements, I've gone with the laziest approach I can think of to accomplish this programatically:

    reverse(a!forEach(enumerate(5), fv!index))

    The Expression Guru
    harshitb6843
    Brainy
    Jul 19, 2022 6:48 PM UTC

    Another approach to this except what Mike mentioned can be - 

    a!forEach(
      items: enumerate(5),
      expression: 5-fv!item
    )

    There can be endless ways of achieving a solution to a problem. But if you specify your use case and explain the problem better, you might find the most accurate ways.