Welcome!

A Smojo Program

What does the program:

	"Welcome to Smojo" . 
	

do?

It has two actions:

	    "Welcome to Smojo"
	

pushes the text onto the stack. Next the word:

	    .
	

pops the text from the stack and prints the result.

A Much Longer Program

	1 2 + . 
	

Try it. How does it work?

	1
	

pushes the number 1 onto the stack.

	2
	

pushes the number 2 onto the stack. So, there are two items on the stack, 1 at the bottom and 2 on top.

	+
	

pops both items off the stack and adds them. It pushes this result back onto the stack. There is now just one item on the stack, the number 3.

	.
	

pops the top item off the stack and prints it to the console.

Words and Literals

In Smojo, everything is either a Word or a Literal.

+
and
.
are Words, and they can do things.
"Welcome to Smojo"
and
1
,
2
and
3
are Literals. They push themselves onto the stack.

Quiz

Run this program:

"Down the street the dogs are barkin'" . cr  "And the day is a-gettin' dark" . cr

Is

cr
a Word or Literal? What does it do?



Next: Artihmetic