Comments

Comments are started with NB[ and are closed with ]

NB[ A comment looks kinda like this. ]

Output in the playground

say can be used in the playground to print a value to the transcript. The transcript is cleared every time you run code in the playground, so only the output from the most recent run is displayed

Quotation & stack teaser

A quotation is started with [ and is closed with ].

If a quotation is prefixed with a word, like this: do[ ] then the word is moved after the quotation at compile time, like so:

do[ ] becomes [ ] do

ask[ thing ] becomes [ thing ] ask

Order of operations

Generally speaking, code in StackTalk is executed left to right. This is usually known as reverse polish notation. The exception is quotations, which gather a list of code that can be executed later (or not), and place it on the value stack

Basic math

That means that math and expressions look like this

1 2 +    NB[ stack has 3 ]
3 4 *    NB[ stack now has 12 ]
5 6 *    NB[ stack now has 30 ]
40 2 div NB[ stack now has 20 ]

Strings

Strings can be written a couple different ways.

The first is using " to delimit the start and end of the of the string in question.

"This is a string"

The second way to write a string is to end a symbol with :

which-looks-like-this: