This section describes the basics of Small, as compiled and interpreted with Embryo.
This summary assumes that you are familar with C. For a full list of differences between C and Small, again, see the full documentation.
There is only one type, known as the "cell", which can hold an integer.
The scope and usage of a variable depends on its declaration.
new
keyword. E.g. static
keyword. static
keyword, but outside of any function. stock
. public
keyword.Remember that the keywords above are to be used on their own. That is, for example:
not:
You can declare constants in two ways:
#define
. const
between the keyword and variable name of a variable declaration. For example, to declare the variable var1
constant, you type var1
cannot be changed.To declare an array, append square brackets to the end of the variable name. The following examples show how to declare arrays. Note the use of the ellipsis operator, which bases the array based on the last two declared values:
A typical function declaration is as follows:
You can pass by reference. That is, the parameter you pass is changed outside of the function. For example:
To pass an array:
Small has the following control structures, which similar to their C counterparts:
The following preprocessor directives are available: