foreach ... process twice

If I have a foreach loop, is it possible to stop processing the current element of the loop, jump to the beginning of the loop and start processing from the same element again? It is like a continuebut when I was processing the Nth element, it re-starts with the Nth element nit N+1.

Not possible with a foreach loop, as it just iterates over all the elements of the list once.
But you can create a similar loop with different constraints, using for...done and local..done, like this:

foo :
  sp colorful,cat,eagle,bottles,rose # Input some images

  index=0
  for $index<$! {
    local[$index] { # Inside this local, it's exactly like in a foreach { ... } loop.
      blur 2
      mirror x
    }

    if u<0.2 index+=1 fi # Go to next image, only with a 20% chance
  }

The example above will be able to process the same image several time.

It’s possible.

Something like this:

N=0
repeat $!
    foreach[$N--1]
       # Something here
    done
    N+=1
done

Another interpretation of your post

repeat 2
    foreach
        # Something 
    done
done

Could you draw a flow diagram? To me, that’s easier to understand.

Good morning, @David_Tschumperle. Yes, that would be it. Thanks.