|
|
|
@ -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: |
|
|
|
|
|
|
|
|
|
- `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 |
|
|
|
|
- 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. |
|
|
|
|
|
|
|
|
|
> No main is needed. |
|
|
|
|
> Note: main is not needed! |
|
|
|
|