Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Bolt on June 30, 2023, 05:45:03 PM

Title: Jump inside FOR/NEXT Loop
Post by: Bolt on June 30, 2023, 05:45:03 PM
Is there a way to "jump" forward inside a FOR/NEXT loop? Similar to the CONTINUE instruction, but not entirely to the end. Rather, to a defined point in the loop.
Title: Re: Jump inside FOR/NEXT Loop
Post by: Controls Guy on June 30, 2023, 10:59:58 PM
Maybe roll up everything you want to skip in a subroutine and don't call it on those passes?
Title: Re: Jump inside FOR/NEXT Loop
Post by: franji1 on July 01, 2023, 10:11:55 AM
GOTO/LABEL  Spaghetti code at its finest.

Just make sure you don't GOTO a LABEL that is out of the loop (stage, code block, etc.)
Title: Re: Jump inside FOR/NEXT Loop
Post by: Bolt on July 03, 2023, 10:02:45 AM
GOTO/LABEL  Spaghetti code at its finest.

Just make sure you don't GOTO a LABEL that is out of the loop (stage, code block, etc.)

Perfect. The help file only showed BREAK, CONTINUE, REPEAT, UNTIL, WEND, WHILE as my options for a FOR Index Loop. GOTO, LABEL however, do link back to FOR, NEXT. I don't think my code will get too spaghetti like with a simple addition to skip partial loop code for certain index ranges.

Thanks!