summaryrefslogtreecommitdiffhomepage
path: root/dart.html.markdown
diff options
context:
space:
mode:
authorKir Malev <playittodeath@gmail.com>2024-05-16 07:25:02 +0400
committerGitHub <noreply@github.com>2024-05-15 21:25:02 -0600
commit5c518f4a316215d49c3efb1bed7846d44bf21b5b (patch)
treeb086edef2c3102df937e8fe00cfe765a954bb70b /dart.html.markdown
parent250a508cbf5cf17404d1b010c508333c417b708f (diff)
[dart/en] Updated exercise 11 (#3880)
Diffstat (limited to 'dart.html.markdown')
-rw-r--r--dart.html.markdown28
1 files changed, 16 insertions, 12 deletions
diff --git a/dart.html.markdown b/dart.html.markdown
index e6594fc5..69b1925b 100644
--- a/dart.html.markdown
+++ b/dart.html.markdown
@@ -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}");