![]() |
B.1 Variables, Data Types, Database Access, Declaring Variables, and Comments |
SheerPower is fast and easy. Have fun coding and being productive!
Variable names start with a letter. Use letters, numbers, or "_". They’re not case-sensitive, so "name" = "NAME".
Routines need an "_" in the name, like do_work
.
Same rules as variables otherwise.
SheerPower supports the following data types:
"Anna"
). STRING variables can also store binary or byte data.
They use the $
suffix or are declared.
%
suffix.
They can also be declared. Rarely used since the REAL data type is generally more useful.
?
suffix or are declared.
The most common data types in SheerPower are REAL, STRING, and BOOLEAN. By default, all numeric variables are assumed to be of type REAL, which is recommended for nearly all numeric operations.
REAL keeps math perfect. No errors like 0.1 + 0.2 - 0.3.
Great for payroll or finance.
Once set, a variable’s type can’t change. This avoids mistakes.
Get data with table(field)
, like
payroll(salary)
.
Set data the same way. It saves smartly later.
Database fields adjust type by use:
This makes coding simpler.
Use declare
to pick a type.
dynamic
lets types shift.
const
sets values that won’t change.
Set a format, like money with $ and 2 decimals.
See more formats.
Make custom types with type
. They stay
consistent.
Use !
or //
for comments. They’re
for you, not the code.
table(field)
.
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. |