1. Getting Started
Installing STencil
Pick one:
- pip: pip install stencil-lang
- Windows installer: run STencil-Setup.exe (adds stencil to PATH, associates .st files)
- After either, a new terminal has the stencil command.
Running code
stencil program.st # run a file
stencil # start the REPL (interactive shell; type exit to quit)
stencil -c "print(1 + 2)" # run a one-liner
Hello, world
Create hello.st:
print("Hello, STencil!");
Run it:
stencil hello.st
Output:
Hello, STencil!
print takes any number of values, separated by commas, and writes them with spaces between, then a newline:
print("Sum:", 2 + 3, "and done"); // Sum: 5 and done
Comments
// single-line comment
/* multi-line
comment */
print("comments are ignored");
Semicolons
Semicolons are optional but recommended for clarity:
let a = 1
let b = 2;
print(a + b) // 3
Next: Variables & Types
Kitteniverse Studios