HP 39 Programming

An HP 38g, HP 39g, HP39g+ and HP40g program contains a sequence of numbers, mathematical expressions, and commands that execute automatically to perform a task. These items are each separated by a colon. Commands that take multiple arguments have those arguments separated by a semicolon. Inside a program, branching structures can be used to control the execution flow. Creating building-block programs enables structured programming to be used. Each building-block program stands alone and can be called from other programs.

program catalogThe main function is the program catalog. This is where programs are created, edited, deleted, sent, received, or run. To open the PROGRAM CATALOG press SHIFT, then PROGRAM. The program catalog displays a list of program names (see right insert). If no programs have been created, the only name that will be seen is EDITLINE. The EDITLINE contains the last expression that was entered from the edit line in HOME, or the last data that was entered in an input form. (In the HOME menu, if ENTER is pressed without entering any data, the HP 3X runs the contents of the EDITLINE).

Creating a new program

To create a new program:

NOTE: A program name can contain special characters, such as a space. However, if special characters are used, and the program is ran by typing in HOME, the program name must be enclosed in double quotes (’ ‘). Do not use the quotation mark symbol within the program name.

Entering commands

While gaining a familiarity with the HP 39g/40g commands, the easiest way to enter commands is to use the commands menu from the PROGRAM EDITOR. Commands can also be typed in using alpha characters. To enter a command:

Editing program

To edit a program: