Dieser Anhang beschreibt die Struktur der Programmiersprache Karel auf einer Seite.
move();
turnLeft();
putBeeper();
pickBeeper();
/* Kommentare können in jeden Teil eingefügt werden
* von a programm. Sie start mit a schrägstrich-star
* and end with a star-slash.
*/public class name extends SuperKarel {
public void run() {
auszuführender Code
}
Deklarationen von privaten Methoden
}
frontIsClear() beepersPresent() beepersInBag() leftIsClear() rightIsClear() facingNorth() facingSouth() facingEast() facingWest() frontIsBlocked()
noBeepersPresent() noBeepersInBag() leftIsBlocked() rightIsBlocked() notFacingNorth() notFacingSouth() notFacingEast() notFacingWest() if( Bedingung ){
Code run wenn die Bedingung erfüllt ist
}
if( Bedingung ){
Codeblock für "ja"
} else {
Codeblock für "nein"
}
for(int i = 0; i < Anzahl ; i++){
Code zu wiederholen
}
while( Bedingung ){
Code zu wiederholen
}
private void Name () {
Code im Hauptteil der Methode.
}
turnRight();
turnAround();
random( p );
paintCorner( Farbe );