[dart/en] Updated exercise 11 (#3880)

This commit is contained in:
Kir Malev 2024-05-16 07:25:02 +04:00 committed by GitHub
parent 250a508cbf
commit 5c518f4a31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -254,25 +254,29 @@ example10() {
/// `int` and `double` are children of type `num`
example11() {
var i = 1 + 320, d = 3.2 + 0.01;
final num myFinalNumDouble = 2.2;
final num myFinalNumInt = 2;
final int myFinalInt = 1;
final double myFinalDouble = 0.1;
num myNumDouble = 2.2;
num myNumInt = 2;
int myInt = 1;
double myDouble = 0; // Dart will add decimal prefix, becomes 0.0;
myNumDouble = myInt; // valid
myNumDouble = myDouble; //valid
myNumDouble = myNumInt; //valid
myNumDouble = myFinalInt; // valid
myNumDouble = myFinalDouble; // valid
myNumDouble = myFinalNumInt; // valid
myNumInt = myInt; // valid
myNumInt = myDouble; // valid
myNumInt = myNumDouble; // valid
myNumInt = myFinalInt; // valid
myNumInt = myFinalDouble; // valid
myNumInt = myFinalNumDouble; // valid
myInt = myNumDouble; //Error
myInt = myDouble; //Error
myInt = myNumInt; //valid
myInt = myNumDouble; // error
myInt = myFinalDouble; // error
myInt = myFinalNumInt; // valid
myDouble = myInt; //error
myDouble = myNumInt; //valid
myDouble = myNumDouble; //valid
myDouble = myFinalInt; // error
myDouble = myFinalNumInt; // error
myDouble = myFinalNumDouble; // valid
print("Example11 int ${i}");
print("Example11 double ${d}");