Interactive Klartext course · Lesson 9 / 15
Subprograms, labels and Q parameters
Reuse a programmed sequence instead of duplicating blocks, and introduce a numeric Q parameter for a value that may change.
What you will learn
- Mark a labeled program section with LBL and end a subprogram with LBL 0.
- Invoke the section with CALL LBL.
- Assign a numeric value to a Q parameter and reuse it in program blocks.
How it works
Labels identify a program location. A subprogram is defined at its label and returns at LBL 0; CALL LBL transfers execution to that labeled section.
Q parameters store numeric values for later expressions or coordinates. They make dimensions and repeated operations easier to adjust consistently.
Klartext example
Try the essential blocks
This compact example introduces the lesson topic. Use the guided practice for the complete checked exercise.
LBL 1
L X+Q1 Y+Q1 FMAX M99
LBL 0
Q1 = +30
CALL LBL 1
L Z+50 FMAX
Ready to practice?