Your First Dart Application
Consider the most straightforward program on Dart.
main.dart
123void main() { print('Hello, World!'); }
As you can see, this program prints the phrase Hello, world!.
-
Every program needs the
main()function, from which code execution begins. Thevoidis a type of function. We will talk about types of functions in the future; -
Dart code is written in the function's body, that is, in curly braces
{}. The space in the curly brackets{}is the function's body, in which we will write all the commands that will work in this function; -
Look at the semicolon
;. After each line of code, we put a semicolon. Otherwise, the development environment will report an error to us. Such line separation is necessary so that the dart interpreter knows where one instruction ends and where another begins.
Bedankt voor je feedback!
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Can you explain more about the `main()` function in Dart?
What other types of functions are there in Dart?
Why is the semicolon important in Dart syntax?
Geweldig!
Completion tarief verbeterd naar 4.55
Your First Dart Application
Veeg om het menu te tonen
Consider the most straightforward program on Dart.
main.dart
123void main() { print('Hello, World!'); }
As you can see, this program prints the phrase Hello, world!.
-
Every program needs the
main()function, from which code execution begins. Thevoidis a type of function. We will talk about types of functions in the future; -
Dart code is written in the function's body, that is, in curly braces
{}. The space in the curly brackets{}is the function's body, in which we will write all the commands that will work in this function; -
Look at the semicolon
;. After each line of code, we put a semicolon. Otherwise, the development environment will report an error to us. Such line separation is necessary so that the dart interpreter knows where one instruction ends and where another begins.
Bedankt voor je feedback!