# 2.1 Tutorial - First steps

### Objects

In JM° there are only Objects, Functions, Events, Variables and Constants. That's it!
So, let's get the first Object.

`5`

The Terminal always shows you the last result after a "=>".
Okay, let's do something:

`5.print`

This get's the Object "5" and calls the function "print". Print is a function, that every object has, and writes the object to the output.

Okay, let's see what type this object is:

`5.type.print`

So, now we can calculate:

`5+3`

Or ...

`16-93*850/7123%12`

Now you have a little calculator.
JM° knows also point before line and you can use brackets.

`5+3*9(5+3)*9`

By the way, the bracket is also a Object and +,-,*,/,% are functions. But later more.

If you want to print the result, you can try:

`5+3*9.print`

Well ... it prints the "9". Why? An alphanumeric function, called with a dot (".print"), has the highest priority.
Let's try this:

`(5+3*9).print`

Now it prints the 32.

### Variables

Variables can store a value. They begin always with a lowercase character and are created on the fly.

`a = 4`

Since the Shell immediately forgets the assignment, we now hang two commands together with a ';'.

`a = 4; a.print`

Now you can calculate a value and store it in the variable.

`a = 3*(9+20); a.print`

Let's try this with two variables:

`a = 3; b = 9+20; (a*b).print`

### Lists

To create a list, we use the []-brackets.

`[4,9,5,2,8,5]`

With such a list, you can do a lot of nice things. Please take a look at the documentation under "List".

`[4,9,5,2,8,5].uniq.sort.reverse.print`

This removes doubles, sorts the list, reverse all items and prints the result.
To get one item, use the .get-Function:

`[4,9,5,2,8,5].sort.get(2).print`

Here, the list will be sorted and we got the second item.
Remember: JM° counts the position, not the index. So 1 gets the first item, 2 the second, and so on.
If you want to use all items and do something with each item, you can use the each-function:

`[4,9,5,2,8,5].each.print`

Uhhh ... 😁
After .each, we can go on with the Int-Number. Here we print it to the screen.
Another function to print is the ".echo"-function. This writes to the screen, but without a newline:

`[4,9,5,2,8,5].each.echo.isEven.print`

For a better result, we use the .echo with a parameter. So it prints that value, not the Int-Number:

`[4,9,5,2,8,5].each.echo.echo(" is even: ").isEven.print`

Echo end Print always return the previous value.
And, here we have a new atomic type: the Str (String)

### Strings

Strings are created with two quotation marks:

`"This is a String!"`

And yes, it is also an object and we can use it the same way like the integer numbers.

`"This is a String!".lower.left(4).print`

Here we transform all chars to lower case and get a copy of the first (left) 4 chars. 