Constants are named values that cannot change. They work like integers, but if a value is used often enough, using constants makes your code easier to read and modify.
Constants are declared in CON
blocks.
CON DOZEN = 12
Variables are named values that can change. All variables in Spin consist of integers of different sizes.
name |
type |
unsigned range |
signed range |
|
8-bit integer |
0 - 255 |
-128 - 127 |
|
16-bit integer |
0 - 65,535 |
-32,768 - 32,767 |
|
32-bit integer |
0 - 4,294,967,295 |
-2,147,483,648 - 2,147,483,647 |
Variables are created in a VAR
block. They are initialized to zero by the compiler.
VAR byte foo word bar long baz