Please enable JavaScript to use CodeHS

Intro to Programming with Karel the Dog (Ace)

Lesson 2.3 The Main Function

Description

In this lesson, students will deepen their understanding of functions by learning about the main function. The main function helps to organize the readability of code by creating a designated place where code that is going to be run in a program can be stored:

function main(){
   turnRight();
}

function turnRight(){
   turnLeft();
   turnLeft();
   turnLeft();
}

main();

Objective

Students will be able to:

  • Explain the functionality of the main function
  • Use the main function appropriately in their programs
  • Improve the readability of their code