Your First Dart Application
Let's 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!
.
Code Syntax
-
Look at the
void main()
. Every program needs themain()
function, from which code execution begins. Thevoid
is a type of function. We will talk about types of functions in the future; -
Look inside the curly brackets
{}
. 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.
Дякуємо за ваш відгук!
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 4.55
Your First Dart Application
Свайпніть щоб показати меню
Let's 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!
.
Code Syntax
-
Look at the
void main()
. Every program needs themain()
function, from which code execution begins. Thevoid
is a type of function. We will talk about types of functions in the future; -
Look inside the curly brackets
{}
. 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.
Дякуємо за ваш відгук!