Skip to content

Commit

Permalink
create examples/hello.dart (Hello World! example #15)
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Jun 12, 2020
1 parent cfe5fda commit ae3614c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Once you have installed `Dart` on your `localhost`
(_or opened [Dart Pad](https://dartpad.dartlang.org)
if you are unable to install it on your mobile device_),
open your text editor of choice
and create a file called `main.dart`
and create a file called `hello.dart`

Then _type_ the following code:

Expand All @@ -151,6 +151,8 @@ main() {
}
```

e.g:

This code creates a function called `main`
which calls `print` with our desired `String` `'Hello World!'`.
The function does not _return_ anything
Expand All @@ -160,7 +162,7 @@ Now in your terminal window,
execute the program by typing:

```sh
dart main.dart
dart hello.dart
```

You should see:
Expand All @@ -186,16 +188,24 @@ void main() {
```

This just means that our `main` function will not return anything.
It's safe to ommit the `void` keywork as it is in _inferred_ by the compiler.
In this case it's safe to ommit the `void` keywork
as it is in _inferred_ by the compiler.
We checked:
https://stackoverflow.com/questions/62346301/does-dart-main-function


> If you are curious about the `void` keyword, read: <br />
> If see the `void` keyword and are curious about it, read: <br />
> + https://en.wikipedia.org/wiki/Void_type
> + https://medium.com/flutter-community/the-curious-case-of-void-in-dart-f0535705e529
> + https://medium.com/dartlang/dart-2-legacy-of-the-void-e7afb5f44df0
<br />

## Variables





## `Dart` Syntax:

Expand Down
File renamed without changes.

0 comments on commit ae3614c

Please sign in to comment.