## Instructions

Congratulations! You just wrote your first program! You got the idea now: programming is nothing more than giving simple instructions to the computer that blindly apply them. The main difficulty is to explain stuff to something as stupid as a computer...

Programs are mainly suites of method calls, which are no more than a list of simple orders given to the machine. It is very similar to a recipe stating Melt the chocolate pieces, add sugar, cool the mix and serve. In your programs, such built instructions are called functions or methods, and you should add parenthesis to invoke them:

    nameOfTheMethod()

[!thelang] wants to have the instructions separated by semi-columns (;)[!python|scala] or by new lines[/!]. The previous example would thus be written in the following way[!python|scala] (you can also add semi-columns at the end of the lines, but this is not mandatory)[/!].

    meltTheChocolatePieces()[!java|c];[/!]
    addSugar()[!java|c];[/!]
    coolMix()[!java|c];[/!]
    serve()[!java|c];[/!]

[!python|scala]

It could also be written in the following way, but it's generally considered as a bad practice to group several instructions on the same line since it greatly hinders the readability.

    meltTheChocolatePieces(); addSugar(); coolMix(); serve()

[/!]

Of course, these specific methods do not exist by default in [!thelang], but it may be possible to define them by yourself (we'll see later how to define your how methods).

For now, we'll simply go for the buggle instructions. There is a method for each button of the interactive control panel. To achieve the same effect than the forward button (making the buggle moving one step forward), you need to write the following in the editor:

    [!java|scala|python]forward()[!java];[/!][/!][!c]stepForward();[/!]

Likewise, to achieve the same effect than the [!java|scala|python]backward[/!][!c]stepBackward[/!], left and right buttons, you need to use respectively:

    backward()[!java|c];[/!]
    left()[!java|c];[/!]
    right()[!java|c];[/!]

The mark button is a bit particular, since it correspond to two methods: the first one moves the pen up while the second moves it down.

    brushUp()[!java|c];[/!]
    brushDown()[!java|c];[/!]

The buggle offers other methods, that are presented from the "Help/about this world" menu and will be introduced on need.

### Exercise goal

Our second program will be a bit more complicated, but not much. The goal for your buggle is simply to draw a house (a box), and hide inside. Check the objective world to see exactly what this means.

Use your brush to mark the ground as you walk. Start marking the ground with `brushDown()`, and stop it with `brushUp()` afterward (e.g., to enter your house without marking its ground). The full list of all instructions understood by your buggle can be found in "Help/About this world".

### After this exercise

When switching to the next exercise, please note that there is a sub-exercise following this one. By default, it is hidden in the menu and you have to open the sub-menu to see it. When you switch the exercise, most of the exercises are hidden because the tree is folded, as follows:

You have to click on the little symbol to the left of the buggle to unfold the tree, as follows: