|
The Structure of a Sheerpower Program |
A Sheerpower program is made from simple, readable structural elements. Each element has a clear purpose, and together they make programs easier to write, test, debug, and maintain.
This tutorial gives a quick overview of the most important structural elements found in Sheerpower programs.
Two statements can be placed on a single source line by separating them with
a backslash \:
This behaves exactly as if each statement were on its own line. In source files, prefer one statement per line for readability and easier debugging.
// or ! to explain
intent, assumptions, non-obvious logic, or other important details.
&.
with and, when needed,
returning. Do not use call or parentheses.
A trailing comma indicates an implied line continuation. For details
see Routines and Variable Scoping.
MY_name
is the same as my_name.
Tutorial examples use lowercase names and snake_case for consistency.
For more details, see Variables, Data Types, Declaring Variables, Comments, and Database Access.
$, Boolean variables end with
?, and numeric variables have no suffix.
end if, end select,
and end do.
%include to bring
shared source code into a program.
%include, %debug, and %todo
provide instructions to the compiler. See Simplified Unit Testing, and Debugging
and Program Segmentation and Source Merging.
The structure of a Sheerpower program is intentionally simple. Programs are built from statements, comments, variables, built-in function calls, routine calls, code blocks, include files, compiler directives, and clear layout conventions.
Understanding these basic elements gives you a mental map for reading and writing Sheerpower code.
Below is a coding sandbox where you can enter, edit, and run
Sheerpower code. Type any Sheerpower code into the sandbox,
then choose Run to try it. Each tutorial includes
a sandbox.
|
Hide Description
|
|
|
Enter or modify the code below, and then click on RUN |
|
Looking for the full power of Sheerpower?
Check out the Sheerpower website. Free to download. Free to use. |