How do I "breaks" the loop at for-each?

0 favourites
  • 3 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies. For use in game and custom works.
  • Hypothesis, I have a JSON data:

    	"data1": "value1",
    	"data2": "value2",
    	"data3": "value3",
    	"data4": "value4",
    	"data5": "value5",

    How can I achieve break, For example, Use For-each entry in path, let the loop jump out when it reaches 'data3'. At first I thought the built-in system actions Stop loop can break, But it's actually continue, Just skip the current loop, not the whole loop.

    Although, I have several solutions to achieve this effect. But I think they always be executed in their entirety once, rather than jumping straight out.



    I hope can find a way to really break to save some of unnecessary performance?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah, "Stop loop" for some reason doesn't work with JSON or Array "for each" loops.

    You can add a local variable continue=1. Add "continue=1" condition to the loop. When you need to stop it, set continue to 0.

  • Use AJAX->On completed

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)