Hello World
Step 1: Create a folder “learning dart” and open it using VS code.
Then create inside this folder a file “helloworld.dart”.
Note: the role of “.dart” extension is to specify a Dart program file.
Step 2: Write this code in it:
void main() {
print("hello World!");
}
- Semicolons ( ; ) :
Every individual statement must be ended with a semicolon (necessary).
- Whitespace, tabs & line breaks:
These are very important to make the program easy to read and understand.
- Block:
{ start of block
statement(s)
} end of block
the role of these two curly braces is to group all of the statements. - main():
The starting point for program execution. A program usually stops executing at the end of main. It is required for every program.
- print():
The function that display the content between double quotes to the screen.
Note: Dart is a case-sensitive.
Ex: “Start” and “start” are not the same.
Step 3: Run the program:
Note: It the debug console is not shown when you clicked on run you must open it .