[9.10] Exit step and continue fo break statement

Hi,
In Java we can have this kind of statement :


for(String s : listStrings) {
   switch(s) {
      case "Case1" :
         continue;
      ....
   }
}

It means if “Case1” exists in listStrings, we go to the next iteration of the loop.

In flowService I can not see how to do this :


LOOP in listStrings
  BRANCH on listStrings
   SEQUENCE Label=Case1
      EXIT on ???? [i]($loop equivalent to break)[/i]

Have you an idea

Not sure your exact usecase but as per the below code snippet this is how the “Enhanced For Loop” will work

char[] vowels = {'a', 'e', 'i', 'o', 'u'};
      // foreach loop
      for (char item: vowels) {
         System.out.println(item);
      }

Output

a
e
i
o
u

Now, putting this in webMethods flow service, you will have a “inStringList” which is a stringList data type (eg., 1, 2, 3, 4) and below attached code snippet will execute all the sequence steps including the $default.

My question is what you are doing in each sequence step? Can you provide your requiement with example?

for-each-loop.PNG

No it’is a simple example;
the code is big and in the LOOP Sequence there are a lot of statements.
If I want a continue statement (I can do in other way with other BRANCH statements), it’s in order to write not to many and nested statements

I find a way

To reuse my example, the solution is


LOOP over /stringsList
  Next: SEQUENCE
    BRANCH on /stringsList
       Case1 : EXIT 'Next'
1 Like

Great and happy to know that, the sample looks similar to mine in the screenshot, you can mark this thread as “Closed”