Reach a label (Code jump)

Command :

GOTO/

Aperçu visuel :


Functionality :

This command allow to "do a jump" to an specific CpcdosC+ code zone on .CPC file.

WARNING:It's not recommended to use this command for jump in another function, for exit loop or IF/ context. This is no-safe, and can cause stack program corruption and crash system.

Not recommended examples :

if/ "value" == "value" then:
    goto/ ok
else:
    goto/ no_ok
end/ si

:ok:
...
:no_ok:
...
Function/ toto()
    goto/ other_function
End/ Function

Function/ other()
    :other_function:
    ...
End/ Function

Avaiable parameters :

  • Label name in the same file.

    [Location name]


Examples :

Example 1

Display 2 line to the screen by jumping the 2nd

txt/ My first line
goto/ Sauter
txt/ My second line
:Sauter:
txt/ My 3nd line

Display on console :

My first line
My 3nd line

Example 2

Display 5 lines in loop

// We begin to zero
set/ value = 0

:begin:

// We add +1 to the "value" variable
set/ value = /C(%value% + 1)

txt/ I'm at %value% nd value!

// If value is strictly at "5", then we jump to "end" label
if/ "%value%" == "5" then: goto/ end

// Else, we loop at "begin"
goto/ begin

:end:
txt/ Ending.

Display on the console

I'm at 1 nd value!
I'm at 2 nd value!
I'm at 3 nd value!
I'm at 4 nd value!
I'm at 5 nd value!
Ending.