# JM° for programmers

It is important to understand that in JM° there are only objects and functions. Each command is therefore just an object with special abilities.
Blocks are indented with tabs, but not specially marked.

## The easiest way

Whenever a block is assigned to an object and the object has an auto-block function, it will be automatically called with .do

### If then else

``````If( 5 == 3+2 )
"It's true".print
.else	"It's not true".print``````

### For loop

``For(10, 20, 2)	%.print``

### While loop

``````While(true)
"Print this endless".print``````

## Going deeper the rabbit hole

### If then else

You can call it directly:

``````If( 5 == 3+2 ).then
"It's true".print
.else	"It's not true".printIf( 5 == 3+2 ).then.print("It's true").else.print("It's not true")``````

We can use the .if-Function that every atomic object has:

``````(5 == 3+2).if	"It's true".print.else	"It's not true".print
true.if	"It's true".print.else	"It's not true".print``````

### For loop

Call it directly:

``````For(10, 20).each.printFor(10, 20, 2).each.printFor(10, 20).each
%.printFor(10, 20).each(:b)
b.print``````

We can use the shortcut:

``{10,20,2}	%.print{10,20}.print{10,20,2}.print{10,20,2}(:b)	b.print``

Or we can use the .times-Function of a Int-Value:

``10.times	%.print10.times.print``

### While

``a = trueWhile(a).do.print(a=false)a = trueWhile(a).do	%.print	a = false``

Here, we can also use a shortcut:

``a = true?{a}	%.print	a = falsea = true?{a}.print(a=false)`` 