How to call different parts of my macro in a loop

Greetings from a KM newbies (Great product!)

I have a KM macro that is initially triggered with a key combination. It then is supposed to run continually in a loop (prob every second)

It does the following:
A. Firstly it runs an Initialisation routine
B. Then it runs its Main routine.
C. When it has finished, depending upon various parameters, it needs to 'loop back' either to the 'Main' routine (in middle of my code) or it need to loop back to the very beginning of my 'Initialisation' routine.

Depending upon certain parameters, in most cases the Main routine needs to be called again and run in a loop.
However some times it needs to loop back to the very beginning and run the Init routine again.

QUESTION-1: Is there the equivalent of a 'GOTO' (my age is showing :slight_smile: routine with KM as this would solve my problems?
i.e. if x=y then Goto 'Initialisation' - else Goto 'Main'

QUESTION-2:
As a way of restarting the whole macro from the beginning, is It legitimate to loop back and run the full routine each timeby calling the actual macro by its name each time using 'Execute a macro' action?
(One solution I guess is to split my macro into sub macros and call them as required.) This seems overkill...

Detailed comments greatly appreciated

Thanks

Mik

As you probably know, modern programming languages don't support the old "GOTO", which are now considered bad design.

But I don't think that's what you have. You simply have conditional branching which is easily handled by a KM If Then Else action, or, Switch Case action.

It sounds like you may want your main loop to be either a While action OR Until action.

Take a look at those references, and if it is still not clear, come back with your questions, and if you have even a partial macro, please upload your macro.