Dart Introduction
Dart is a programming language that also powers Flutter apps. This course teaches plain Dart programs.
A greeting on screen
This short program shows one greeting. The greeting is the whole output.
void main() {
print('Hello from Dart');
}Two lines in order
The first print runs before the second print. Each line appears below the one before it.
void main() {
print('First line');
print('Second line');
}A number on screen
print can also show a number by itself. This program shows the number 3.
void main() {
print(3);
}Example
void main() {
print('Welcome');
print('Dart');
print(1);
}Key points
- Dart code in this course runs as plain programs on a computer.
- Use print to put a value on the screen.
- A text value in code sits inside single quotes.
- A Dart program is a set of instructions a computer follows.
In this example, the first print shows Welcome. The second print shows Dart below it. The third print shows the number 1 below Dart.
Try it Yourself
Edit the code, then press Run.
Running is simulated Β· DartPad
Exercise
What is Dart?