Popup YouTube Video
Sheerpower Logo

The Structure of a Sheerpower Program


A brief overview of the main structural elements used in Sheerpower programs, including statements, comments, function calls, routine calls, variables, blocks, directives, and layout conventions.

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.

  • Statements — one logical instruction at a time.
  • Comments — use // or ! to explain intent, assumptions, non-obvious logic, or other important details.
  • Line continuation — long statements can continue when the compiler can see that more input is required, including comma continuation in built-in function calls and routine calls.
  • Built-in function calls — use parentheses, with multiple arguments separated by commas. A trailing comma indicates an implied line continuation.
  • Routine calls — use with and, when needed, returning. Do not use call, and do not use parentheses. A trailing comma indicates an implied line continuation.
  • Variable naming — Sheerpower is case-insensitive. Tutorial examples use lowercase names and snake_case for consistency.
  • Type suffixes — when a variable's type is not explicitly declared, Sheerpower uses suffixes to identify common types: string variables end with $, Boolean variables end with ?, and numeric variables have no suffix.
  • Code blocks — structured blocks use clear ending statements such as end if, end select, and end do.
  • Routines — reusable code sections used to organize related logic.
  • Include files — use %include to bring shared source code into a program.
  • Compiler directives — directives such as %include, %debug, and %todo provide instructions to the compiler.
  • Program flow — programs normally execute from top to bottom, with loops, branches, routines, and exception handling controlling the flow when needed.
  • Layout conventions — use indentation, line wrapping, spacing, and clear organization to make programs easier to read and maintain.

Summary

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.