Previous | Contents | Index |
STEP OVER |
Example 2-23 STEP OVER Command |
---|
|
The STEP OVER command is used when the next statement is a call to a routine, and you do not want to step into the routine and look at it. You want to "step over" it.
You must start a program with RUN before you can use the STEP OVER command. STEP OVER is also used after a HALT or BREAK has executed.
Note: When you're in the Console window, you can use the [F1] key as a shortcut to issue the STEP command.
STEP OUT |
Example 2-24 STEP OUT Command |
---|
|
The STEP OUT is for when you are in a routine and do not want to continue to be stepping through each statement in the routine. This allows you to STEP OUT of the routine.
You must start a program with RUN before you can use the STEP OUT command. STEP OVER is also used after a HALT or BREAK has executed.
Note: When you're in the Console window, you can use the [F3] key as a shortcut to issue the STEP OUT command.
DEBUG ON SET WATCH var_name |
Example 2-25 Using SET/CANCEL WATCH in DEBUG system |
---|
debug on x=5 set watch x x = x + 1 print 'The Watch Window is now open and displaying the old and new value of x' delay 5 cancel watch x debug off end |
SET WATCH is used for when you want to watch a variable to see when its content changes to help debug code.
When the content of the variable that you're watching changes, the Watch Window will open and display the content each time it changes.
Note that DEBUG ON must be set before using SET WATCH.
CANCEL WATCH will close the Watch Window when executed.
In the console window, the mouse can be used to select (highlight) text on the screen.
Below is a table containing the special keystrokes available when working in the console window.
Keystroke | Function Performed |
---|---|
ctrl/a | selects all text (both on and off screen) |
alt/b | causes program execution to HALT |
ctrl/c | places selected text into the clipboard |
ctrl/m | places contents of message history into the clipboard |
ctrl/t | places contents of screen (including scroll buffers) into the clipboard |
This chapter describes the basic elements that make up a Sheerpower program. It also describes the types of data used with Sheerpower programs and how the data is processed.
Sheerpower programs have a default extension of .SPSRC. It is recommended that you use this extension for all of your Sheerpower programs. Sheerpower source programs are saved as text files. You can edit Sheerpower source programs with any text editor.
3.2 Sheerpower Program Elements
A program is a series of instructions. These instructions describe how to manipulate data to produce a desired result. You determine what data the program will manipulate, how the program will manipulate it, and what the results of these manipulations will be.
When you create a program, you must use instructions that Sheerpower understands. The Sheerpower language provides these instructions. The language consists of statements. These statements are something like the words in this manual. You put them together in a meaningful order and Sheerpower executes the program you write. Here is an example of a Sheerpower program:
Example 3-1 Basic Sheerpower Program Example |
---|
input 'Please enter your name': name$ print 'Hello, '; name$ print 'Today is '; day$ print name$; ', have a good '; day$ end |
The INPUT statement tells Sheerpower to ask for a name. The PRINT statements tell Sheerpower to print the information. END tells Sheerpower it has reached the physical end of the program.
PROGRAM prog_name |
Example 3-2 Program Statement |
---|
program display_name input 'Please enter your name': name$ print 'Hello, '; name$ end |
The PROGRAM statement is used to name your program.
PROGRAM is used to name programs. prog_name is the program name. The program name must meet the following specifications for variable names:
With Sheerpower, when you execute this program, it will look like this:
Please enter your name? Tester <---type your name here then press [Enter] Hello, Tester |
3.2.2 Sheerpower Reserved Words
When you run the next program example, you will notice that the day is not asked for. DAY$ is a reserved word that Sheerpower uses for storing the day. There are several other reserved words that Sheerpower uses. You can refer to Appendix B, Reserved Words to see a complete list of the reserved words in Sheerpower.
Example 3-3 Sheerpower Reserved Words |
---|
input 'Please enter your name': name$ print 'Hello, '; name$ print 'Today is '; day$ print name$; ', have a good '; day$ end Please enter your name? Julian Hello, Julian Today is Tuesday Julian, have a good Tuesday |
3.3 Sheerpower Program Structure
Sheerpower programs are modular in structure. Every program can be divided into program units. The main unit is the main body of the program. This unit begins with the first program line and ends with the END statement.
first program line -- input 'Please enter your name': name$ print 'Hello, '; name$ print 'Today is '; day$ print name$; ', have a good '; day$ end statement -- end |
END |
Example 3-4 END statement |
---|
input 'Please enter your name': name$ print 'Hello, '; name$ end Please enter your name? John Hello, John |
The END statement is used to mark the physical end of a program. It should be the last line of your program.
The END statement marks the end of a program. When Sheerpower executes the END statement, it writes all active output buffers and closes all files in the current program.
STOP |
Example 3-5 STOP Statement |
---|
input 'Please enter your name': name$ input 'How old are you': age if age < 1 then print 'Not a valid age' stop end if print name$; ' is'; age end Please enter your name? Ted How old are you? .5 Not a valid age |
STOP is used to terminate program execution where you do not want to mark the physical end of your program.
Previous | Next | Contents | Index |