aboutsummaryrefslogtreecommitdiff
path: root/doc/docs/doc/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/docs/doc/README.md')
-rwxr-xr-xdoc/docs/doc/README.md20
1 files changed, 10 insertions, 10 deletions
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md
index 1d9c8ad..c0312f7 100755
--- a/doc/docs/doc/README.md
+++ b/doc/docs/doc/README.md
@@ -1516,21 +1516,21 @@ catch err
1516</pre> 1516</pre>
1517</YueDisplay> 1517</YueDisplay>
1518 1518
1519### Try! 1519### Try?
1520 1520
1521`try!` is a more concise error handling syntax that omit the boolean status from the `try` statement, and it will return the result from the try block when success, otherwise return nil instead of error object. 1521`try?` is a simplified use for error handling syntax that omit the boolean status from the `try` statement, and it will return the result from the try block when success, return nil instead of error object otherwise.
1522 1522
1523```moonscript 1523```moonscript
1524a, b, c = try! func! 1524a, b, c = try? func!
1525 1525
1526-- with nil coalescing operator 1526-- with nil coalescing operator
1527a = (try! func!) ?? "default" 1527a = (try? func!) ?? "default"
1528 1528
1529-- as function argument 1529-- as function argument
1530f try! func! 1530f try? func!
1531 1531
1532-- with catch block 1532-- with catch block
1533f try! 1533f try?
1534 print 123 1534 print 123
1535 func! 1535 func!
1536catch e 1536catch e
@@ -1539,16 +1539,16 @@ catch e
1539``` 1539```
1540<YueDisplay> 1540<YueDisplay>
1541<pre> 1541<pre>
1542a, b, c = try! func! 1542a, b, c = try? func!
1543 1543
1544-- with nil coalescing operator 1544-- with nil coalescing operator
1545a = (try! func!) ?? "default" 1545a = (try? func!) ?? "default"
1546 1546
1547-- as function argument 1547-- as function argument
1548f try! func! 1548f try? func!
1549 1549
1550-- with catch block 1550-- with catch block
1551f try! 1551f try?
1552 print 123 1552 print 123
1553 func! 1553 func!
1554catch e 1554catch e