Menu
Coddy logo textTech

The main Function

Part of the Fundamentals section of Coddy's Dart journey — lesson 2 of 94.

Every Dart program requires a main function as its entry point where execution begins.

void main() {
  print('Hello, Dart!');
}

Here, void means no return value, main is the function name Dart looks for at startup, () can hold inputs, and {} contains the code to execute.

Cheat sheet

Every Dart program requires a main function as its entry point:

void main() {
  print('Hello, Dart!');
}

void means no return value, main is the function name, () can hold inputs, and {} contains the code to execute.

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals