docs(variables): fixing the structure of the readmes and adding the hints section

This commit is contained in:
miguel 2023-03-14 09:35:50 +00:00 committed by MSilva95
parent 195c0d3302
commit 8f241a0a84
1 changed files with 14 additions and 9 deletions

View File

@ -2,7 +2,17 @@
### Instructions
You can declare variables in two ways. The type can be implicitly detected using the `var` keyword, or explicitly by declaring the variable's type:
Declare and initialize following variables:
- `obj` of type `Object` containing any value;
- `planet` of type `String` containing planet's name you live on;
- `year` of type `int` containing current year;
- `lucky` of type `bool` containing true of false (you decide);
- `pi` which is a constant of type `double` containing the value of pi with 2 decimal points;
### Hints
There are two ways to declare variables in Dart:
```dart
var strPatrick = 'Patrick';
@ -12,12 +22,7 @@ var strPatrick = 'Patrick';
String strSpongebob = 'Spongebob';
```
Declare and initialize the following variables:
- The first way declares using `var` which detects variable types automatically.
- The second way explicitly declares the variable's type using the appropriate keyword, such as `String` for strings, as shown in the example.
- `obj` of type `Object`, containing any value.
- `planet` of type `String`, containing the name of the planet you live on.
- `year` of type `int`, containing the current year.
- `lucky` of type `bool`, containing `true` or `false` (you decide).
- constant `pi` of type `double`, containing pi value with 2 decimal places
> No main is needed.
> Note: main is not needed!