< TI-Basic Z80 Programming < List of Commands

Lbl is used with the commands Goto and Menu. When a Goto command is issued, the program will branch from the Goto to the proper Lbl.  :Goto WB  :  :  :Lbl WB In the above example, the program would branch from Goto WB and move to Lbl WB. The WB on the Goto and Lbl tells the program what label to goto. The naming convention for labels:

  • The name must be made up of any combination of numbers, uppercase letters, and/or theta(s).
  • The name must not exceed two characters in length.

RIGHT:  :Lbl ΘΘ WRONG:  :Lbl ?? RIGHT:  :Lbl 9X RIGHT:  :Lbl WB WRONG:  :Lbl WikiBooks

Lbl must be the first command after a colon:
RIGHT:  :X+10→X:Lbl 10

 :Lbl 10

 :Lbl 10:X+10→X WRONG:  :X+10→XLbl 10

 :8*10Lbl 10

=Using Lbl with Other Commands

Lbl is useless without use of the Goto command, or the Menu command. As explained above, Goto will branch the program to the corresponding Lbl.

  • You can have multiple Goto commands, but...
  • You cannot have multiple Lbl commands.

If you were to have multiple Lbls, then the calculator goes to the first Lbl it finds in the program, starting from the top. This rather defeats having multiple Lbls.
RIGHT:  :Goto 78  :commands  :commands  :commands  :Lbl 78  :commands

 :Lbl 78  :commands  :commands  :Goto 78 Using Lbl and Goto, you can create a loop. This practice has been greatly depreciated, and you should instead use commands such as Repeat, If-Then, etc.

  • Lbl and Goto should only be widely used for menus, where they are required. Otherwise, try and use alternate commands.

Menus also utilize labels. When a user selects an option from the menu, they are taken to the corresponding label. Syntax is as follows: (note that this merely shows where the proper values should be inserted)  :Menu("Menu Name,"Option Name",Label Name) A working example:  :Menu("MENU NAME","OPTION 1",L1,"OPTION 2",L2)  :Lbl L1  :commands  :commands  :Lbl L2  :commands In the above example, if the user selects OPTION 1, then they would be taken to Lbl L1.


In order to understand Lbl completely, you should also read:

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.