Skip to content

Commit

Permalink
[dart/en] Updated example14 (#3881)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyorimi authored May 16, 2024
1 parent 5c518f4 commit ef5bdf1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dart.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,15 @@ example14() {
if (a) {
print("true, a is $a");
}
a = null;
a = false;
if (a) {
print("true, a is $a");
print("true, a is $a");
} else {
print("false, a is $a"); /// runs here
}
/// dynamic typed null can be convert to bool
var b;/// b is dynamic type
/// dynamic typed null can not be convert to bool
var b; /// b is dynamic type
b = "abc";
try {
if (b) {
Expand All @@ -331,17 +331,17 @@ example14() {
} catch (e) {
print("error, b is $b"); /// this could be run but got error
}
b = null;
if (b) {
b = null;
if (b) { /// Failed assertion: boolean expression must not be null)
print("true, b is $b");
} else {
print("false, b is $b"); /// runs here
print("false, b is $b");
}
/// statically typed null can not be convert to bool
var c = "abc";
c = null;
/// complie failed
/// compilation failed
/// if (c) {
/// print("true, c is $c");
/// } else {
Expand Down

0 comments on commit ef5bdf1

Please sign in to comment.