First Application
Let's consider the most straightforward program on Dart.
main.dart
As you can see, this program prints the phrase Hello, world!
.
Code Syntax
Look at the void main()
- Every program needs the
main()
function, from which the code execution begins; void
is a type of function. We will talk about types of functions in the future.
Curly Braces
Look at the curly braces {}
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/6c50e4ca-84bd-4453-8f6b-005f476dced4/e6991a5f-8816-441d-a604-fa6c0a5ed884_img3.jpeg)
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.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/6c50e4ca-84bd-4453-8f6b-005f476dced4/e6991a5f-8816-441d-a604-fa6c0a5ed884.jpeg)
Semicolon
Look at the semicolon ;
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/6c50e4ca-84bd-4453-8f6b-005f476dced4/e6991a5f-8816-441d-a604-fa6c0a5ed884_img4.jpeg)
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.
Note
A Dart interpreter is a program that converts Dart code into machine code that a computer can execute. It works by reading Dart code, instruction-by-instruction, and converting them into a sequence of machine instructions. The computer can then execute these machine instructions.
Task
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/6c50e4ca-84bd-4453-8f6b-005f476dced4/e6991a5f-8816-441d-a604-fa6c0a5ed884_img2_v2.jpeg)
Все було зрозуміло?
Зміст курсу
Introduction to Dart
1. First Acquaintance with Dart
2. Variables and Data Types
3. Conditional Statements
4. List and String
Introduction to Dart
First Application
Let's consider the most straightforward program on Dart.
main.dart
As you can see, this program prints the phrase Hello, world!
.
Code Syntax
Look at the void main()
- Every program needs the
main()
function, from which the code execution begins; void
is a type of function. We will talk about types of functions in the future.
Curly Braces
Look at the curly braces {}
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/6c50e4ca-84bd-4453-8f6b-005f476dced4/e6991a5f-8816-441d-a604-fa6c0a5ed884_img3.jpeg)
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.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/6c50e4ca-84bd-4453-8f6b-005f476dced4/e6991a5f-8816-441d-a604-fa6c0a5ed884.jpeg)
Semicolon
Look at the semicolon ;
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/6c50e4ca-84bd-4453-8f6b-005f476dced4/e6991a5f-8816-441d-a604-fa6c0a5ed884_img4.jpeg)
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.
Note
A Dart interpreter is a program that converts Dart code into machine code that a computer can execute. It works by reading Dart code, instruction-by-instruction, and converting them into a sequence of machine instructions. The computer can then execute these machine instructions.
Task
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/6c50e4ca-84bd-4453-8f6b-005f476dced4/e6991a5f-8816-441d-a604-fa6c0a5ed884_img2_v2.jpeg)
Все було зрозуміло?