Programming with Ophis
<<< Previous | Labels and aliases | Next >>>

# Anonymous labels

Anonymous labels are a way to handle short-ranged branches without having to come up with names for the then and else branches, for brief loops, and other such purposes. To define an anonymous label, use an asterisk. To refer to an anonymous label, use a series of `+` or `-` signs. `+` refers to the next anonymous label, `++` the label after that, etc. Likewise, `-` is the most recently defined label, `--` the one before that, and so on. The main body of the Hello World program with anonymous labels would be:

            ldx #0
    *       lda hello, x
            beq +
            jsr $ffd2
            inx
            bne -
    *       rts

It is worth noting that anonymous labels are globally available. They are not temporary labels, and they ignore scoping restrictions.

<<< Previous | Home | Next >>>
Labels and aliases | Up | Aliasing