For Each without list


Hello guys,

I think it's a good idea for Each to lose the obligation to be assigned a list.

We could have a "Number of turns" parameter, and the for each would run the required amount.

This would save time and complexity, because in a case like this, we programmers create an if and a counter, and exit this loop when the counter reaches its limit.


Created on 15 Jan
Comments (10)

I did not really get the idea to have a for each without a list, but the for each for any programming language is defined to iterate in a list of something.

I don't know if your idea is to improve the for each or to create another loop element (called for or while), because I think this runs out of the purpose of the for each.

Hi William,

Really the create of a while would be the good idea.



I think the whole low-code idea is to try to abstract things as far as possible, adding another programming concept won't help it.  

I agree with Roman, A while or loop is easily implemented in outsystems with an if widget

I think that allowing a For Each without a list would add complexity and could be confusing, so I do not think that is a good idea.

However, having new widgets for other types of loops is a good idea. I know you can easily implement for and while loops with an if, but having a loop widget for those could save some time and possibly avoid logic errors.

So folks, the moment I saved my idea, I had not thought about creating a new Widget, which in my view would be much cooler a While or a For.
I know that a situation like this can easily be created with IF, but it would be much more beautiful to use the component itself, since we use the IF because there is no other option.

The idea I had, was to add another parameter in the "For Each" widget, such as "Total interactions", with which we could make this use, follow the example below that went through my head.

Changed the category to Backend

Hi Eduardo,

I understand what you mean but, IMHO, it's about trade-off. How many times we need Foreach like it is? How many times we need it like you propose? Maybe the time spend to implement that and the complexity that will increase in the development scenario just don't compensate.



Yes I understood that it is somewhat complex to implement such functionality, but the use for new programmers would be easier to understand.

And in logic it would be less confusing than having an IF together with a contactor

This is like a for or while loop.

If you desire such a structure you can make it yourself by creating a counter variable and an if statement.

Here's a bit of pseudo code to illustrate what I mean:

if (counter < 10){
counter = counter + 1;
} else {

I can understand your desire for this, sometimes you want to generate an item 10 times, but you don't want to create 10 assigns or something. (Though in web development this is usually about elements on screen).

I think this might have some value for some things, but you can always create a simular loop using an if statement, so adding this to Outsystems doesn't seem like much of a priority. An actual for or while loop would be more beatiful I agree, it would save a few variables and besides, a loop using an if is asking for troubles, you might make an infinite loop and the system won't be able to recognize it (as of this time of writing).