🌱 Beginner's Guide lesson 12 of 12

Where to Go Next

You made it to the end of the guide! Take a second to look back: you started with a single jongyeytha, and now you know variables, types, decisions, loops, functions, arrays, structs, classes, optionals and modules. That's the core of programming, and it carries over to every other language you'll ever learn. Seriously, well done.

Cheat sheet

Every steav2 keyword you've met, in one place:

steav2 English used for
bongSlanhOun (ceremony) the first line of every program
jongyeytha print showing a value in the terminal
akthe let making a variable
ber / minjengte if / else making decisions
ng / reu and / or combining questions
ok / ort true / false the two Boolean values
nvpeldae while repeating while something is true
somhab for counting loops
rupamun function naming a piece of code
morvenh return handing back a function's answer
sampoan struct your own copied value types
tnak class your own shared object types
nis this the object a method belongs to
sone nothing the missing value in an optional
yok / jea import / as using a module, with a nickname

And the types: Lek and LekThom (decimal numbers), LekKut (whole numbers), Ahsor (text), Boolean (yes or no), [T] (an array of T) and T? (maybe a T, maybe sone).

One last program

Here's a little celebration that uses a bit of everything:

[ try-it.sts ]
bongSlanhOun "celebrate";
rupamun repeat(text: Ahsor, times: LekKut) -> Ahsor {
    akthe result = "";
    somhab (akthe i: LekKut = 0; i < times; i += 1) {
        result += text;
    }
    morvenh result;
}

akthe height: LekKut = 5;
somhab (akthe row: LekKut = 1; row <= height; row += 1) {
    jongyeytha repeat(" ", height - row) + repeat("*", 2 * row - 1);
}
jongyeytha repeat(" ", height - 1) + "|";
jongyeytha "You did it!";
[ what it prints ]
    *
   ***
  *****
 *******
*********
    |
You did it!

Try changing height, or swapping "*" for another symbol.

More examples to explore

The File menu at the top of the playground (the drop-down next to the Run button) has more programs to open, run and poke at:

  • hello.sts: the welcome program, with a few tips in its comments.
  • basics.sts: a quick recap of variables, decisions, loops, functions and arrays.
  • tour.sts: a whirlwind tour of the whole language, top to bottom. You'll recognise almost everything in it now.
  • mistakes.sts: a program where every line is a mistake, to see all the errors steav2 can catch for you.
  • raytracer.sts: a tiny ray tracer, a program that draws a 3D picture by working out how light bounces around. It's built from vectors, structs, classes and optionals, the very things you just learned!

Feel free to change the examples however you like. If you break one, the Reset button puts it back the way it was (in the terminal, restore tour.sts does the same).

The terminal is a playground too

The terminal on the right isn't just for output. Click in it and type help to see everything it can do: list your files with ls, start a brand new program of your own with edit mine.sts, and more.

Best of all, you can type steav2 code straight at the prompt, one line at a time, and see the answer immediately. Try:

  • akthe x = 21;
  • then x * 2

It'll answer 42. That's a great way to quickly test an idea without writing a whole program.

Built-in help

  • Hover your mouse over a keyword like somhab in the editor to see what it means. Hovering works on module functions like sqrt too.
  • No mouse? Put the cursor on a word and press Ctrl+K (or Cmd+K on a Mac).
  • After a run, press Geeky Stats to see nerdy numbers about how your program ran: how long it took and what the virtual machine was up to.

The Language Reference

This guide explained things the gentle way. When you want all the details, like every function in math, all the vector tricks, or exactly how types work, read the Language Reference (at /reference). It's written for people who already know the basics, which now includes you.

Ideas to try next

  • A number guessing game: pick a secret number with random, and use a loop to check a list of guesses, printing "higher" or "lower".
  • A shopping list: a tnak holding an array of items, with methods to add items and print the list.
  • A multiplication quiz that works out the answers to the 12 times table and prints them in a neat grid.
  • Open raytracer.sts and change a colour or move a sphere.

Programming is learned by doing, breaking things, reading the error, and fixing them. You've got everything you need. Have fun!

  • steav2♡ help
  • Y2K✓ ready
  • wasminside
  • .stsvalid

best viewed at 1024x768 ☆ made with ♡ ☆ the reference is steav2's own docs