Programs are mainly suites of method calls, which are no more than a list of simple order 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];[/!] addSugar()[!java];[/!] coolMix()[!java];[/!] serve()[!java];[/!][!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 [!java]Java[/!][!scala]Scala[/!][!python]Python[/!], 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:
forward()[!java];[/!]Likewise, to achieve the same effect than the backward, left and right buttons, you need to use respectively:
backward()[!java];[/!] left()[!java];[/!] right()[!java];[/!]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];[/!] brushDown()[!java];[/!]
The buggle offers other methods, that are presented from the "Help/about this world" menu and will be introduced on need.
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: