Adding Cycle for

Why there is not an activity with the sentence for?

I just see the activities for each and for each row
However, It wiil be great that cycle for will be Integrated

for x=10 to 5 step -1

next

1 Like

Why not just use a while loop instead?

Because FOR is easier and it doesn’t need an instruction additional as the while (the increment)

For is more direct than while

Yes that’s fair enough. I seem to remember thinking that 2 years ago. I
guess we have just got used to it the way it is. Worth an ask though!

Moved to Ideas.

I remember this topic was somewhere on the old forums… maybe it got lost during migration. Either way there was a reason for it not being there (aside of MS not providing one, that is), but I can’t recall it - @badita ?

Yes, it is easier but not easy to implement (it can take multiple types as input). There are other bigger issues right now. :slight_smile:

1 Like

In my opinion I don’t think a for loop should be implemented. You should use For Each as much as possible because it helps you with developments. In those cases where a for each is not possible just use a while. Like @badita mentioned there are bigger issues right now.

2 Likes

You can use the available For Each activity with an input like this: Enumerable.Range(start, count), which generates a list of count sequential integers starting at start. To obtain your specific loop you could use Enumerable.Range(5, 6).Reverse. Admittedly, it doesn’t look as nice as the real loop, but it does the trick. Alternatively, the Community version now has a Code activity to allow putting arbitrary VB code into workflows.

2 Likes