Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4746

GOTO to a return in a subroutine amidst multiple If-Then's

$
0
0
Are there any caveats to using multiple GOTOs to a single return from within IF-THEN-ELSE's in a subroutine? I am using it to skip irrelevant code once the first condition is met.

Example (for reference only, not trying to actually do anything):

Code:

carry_out_logic:

    if counter=4 then
        toggleme=~toggleme
        LED_4=1
        goto continueon
    endif

    if counter=6 then
        LED_6=1
        goto continueon
    endif

(...other if-then stuff...)

continueon:
return

I know I can make use of ELSIF to skip irrelevant code, but it just gets really messy to read when dealing with multiple conditions in multiple IF's.

Viewing all articles
Browse latest Browse all 4746

Trending Articles