Implement a "while-like" widget

By Ângelo Sousa on 8 Nov 2017

I know using a For Each widget covers the majority of cases where a loop-like behaviour is needed, and I have already used some kind of counter based systems with an if widget when I need to have an action do a cycle for some reason, but it always seemed a bit of a stretch to create a local variable, increment it and have it jump out the cycle when the iteration condition is met. 

is it possible to implement a while-like widget?



Jorge Martins9 Nov 2017

Isn't what you just described the typical implementation of a for-loop in any of the mainstream programming languages (PHP, C#, Java, JavaScript, Swift, etc...)?

The standard implementation of a "while" in any programming language isn't more than:

  1. If (condition) {
  2.   < implement your logic here >
  3.   go to 1.
  4. }

The main difference is in OutSystems you can see the "go to" (the loop!) visually as a connector back to the If tool...

Ângelo Sousa9 Nov 2017

Hi Jorge

Yes I know that's what is behind a "while", which is why I was wondering if it is possible for OutSystems to implement a widget that does that logic in the background just like a ForEach does.  I realize this is nitpicking, but since the structure is always relatively the same (create a counter variable, insert if counter < end value, do the logic), I don't think it would be that hard