User Tools

Site Tools


examples

Table of Contents

Examples

Hello World!

Well, no introduction to any programming (or scripting) language would be complete without the traditional and ubiquitous Hello World! example. The basic unit of code in 10LC is called a Program. You can have multiple programs in a single file, if you wish. Programs are opened via the Program statement, and closed with the EndProgram statement. So, here 'ya go! First

Program HelloWorld;
    Display "# - Hello World - ";
EndProgram;

The above program, when compiled and executed on the 9010A, will emit a beep and display - HELLO WORLD - . Note the trailing space - 10LC performs automatic conversion of trailing spaces (in display strings) to underscore characters so that they display correctly on the 9010A's display. Also, just like in 9LC, the pound/hash sign (#) is used with the display to cause the 9010A unit to beep.

Basic Loops

Loops in 10LC are constructed using Labels, Goto statements, and If statements. For example, here is the implementation of a simple delay loop:

:Delay                           // Delay Routine, Register F Contains The Delay Value
    --RegF;                      // Decrement Delay Counter
    If RegF > 0 Goto Delay;      // If Greater Than Zero, Go Back To Start Of Loop
// End
examples.txt · Last modified: 2020/02/21 09:23 by jtwine