S2 Guide: Language Tutorial

S2 is a programming language designed.

Literals
Literals are basically ways of defining values inside of code.

Strings
There are two different types of strings in S2.

The first kind comes in between double quotes:

The second kind comes in between sets of three double quotes:

Some characters need to be escaped to show up properly in strings, with a backslash (\):


 * If you need a newline, use: \n
 * If you need a double quote inside single double quotes (or need to make three or more double quotes inside a triple double quotes), use: \"
 * If you need to make a backslash, use: \\
 * If you want to make a dollar sign (you'll learn why later in variables), use: \$

Integers
Integers (whole numbers) are another value like strings that the S2 language understands. This is an example of a variable being assigned a literal integer value:

True/False
You can also use true and false as values in code:

Arrays
An array is a list of items. They must all be the same type! Here is an example with strings:

Hashes
A hash is like an array, except instead of just a list of items, all of those items get to have a "key" labeling it. All keys must be strings, and all the times must be the same type. Here's an example with strings: