Apart from wait, create object, and async. Actions , everything is done in order from top to bottom, an action is over before the next one.
every tick add 1 to variable
Variable greater than 6, set it to 0 . [...]
If variable equal 0, [...] find path
Be sure that the event to set it to 0 does not occur right before checking it, or more simply, use a time difference, it is more adapted to your use.
create object and spawn another object are not done before the next top level event (aka the next event that is not a sub event of another one).
For every async conditions, there is a trigger associated with it (local storage, ajax, etc..)
If you check a value and do a loop, just see the order you did it, the loop comes first? Then it will check the value everytime, it is after? Then the oppositz, the value is checked before doing the loop.
Sequencing can be problematic since the time between two events can vary (heck even if it was not the case, switching to a display of 120Hz would make it twice as short as a 60Hz display).
Never used while loops as I prefer to use for loops, but maybe they are more flexible, be sure that it will not be endless.