Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Goto and Lbl and Call

Peter Tillema edited this page Nov 26, 2018 · 2 revisions

The Goto and Lbl tokens work the same way they do in TI-BASIC, Lbl defines a point in the program with a name, and Goto will jump to the assigned label and continue execution from there. Label names can consist of up to 10 random characters.

ICE also gives you a Call token, available from the [Trace] menu in the program editor. The Call token will go to a label, and continue executing until it hits a return token or the end of the program, then will jump back to the original Call token and continue from there. This means that you can have sub-routines in your program that can be used to save space if you find yourself using the same snippets of code over and over. Example:

rand→A
If A>1000
    Call SOMETHING
End
Goto OTHER
Lbl SOMETHING
A*238→B
Return
Lbl OTHER

Although a very simple example, it shows the point. The example generates a random number, stores it into A, then checks if A is greater than 1000. If so, it then calls the "SOMETHING" label, from there it multiplies A by 238 and stores the result into B, and returns from the call. Then it jumps to the "OTHER" label and continues program execution. (In the example case, the program ends because there is nothing after the "OTHER" label).

Clone this wiki locally