{"id":106763,"date":"2026-09-18T09:24:37","date_gmt":"2026-09-18T01:24:37","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/106763.html"},"modified":"2026-09-18T09:24:37","modified_gmt":"2026-09-18T01:24:37","slug":"%e3%80%90%e4%bb%93%e9%a2%89%e8%af%ad%e8%a8%80%e5%85%a5%e9%97%a8-%c2%b7-%e7%ac%ac9%e8%af%be%e3%80%91","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/106763.html","title":{"rendered":"\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011"},"content":{"rendered":"<h2>\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011\u53ef\u7a7a\u7c7b\u578b ? \u4e0e Option&#xff1a;\u8ba9&#034;\u6ca1\u6709\u503c&#034;\u65e0\u6cd5\u4f24\u4eba<\/h2>\n<p>\u4e0a\u8282\u8bfe\u6211\u4eec\u5728 HashMap \u7684\u8f93\u51fa\u91cc\u53cd\u590d\u770b\u5230 Some(138-0000-0001)\u3001NoneValueException: Value does not exist!\u2014\u2014\u5f53\u65f6\u53ea\u7559\u4e86\u53e5&#034;\u7b2c 9 \u8bfe\u8bb2&#034;\u3002\u8fd9\u8282\u8bfe\u5c31\u6765\u6b63\u5f0f\u8ba4\u8bc6\u5b83\u4eec\u80cc\u540e\u7684\u8bbe\u8ba1&#xff1a;\u53ef\u7a7a\u7c7b\u578b ? \u4e0e Option\u3002<\/p>\n<p>\u672c\u6587\u662f\u7cfb\u5217\u7b2c 9 \u8bfe&#xff1a;\u7406\u89e3\u4ed3\u9889\u4e3a\u4ec0\u4e48\u6562\u8bf4&#034;\u4ece\u7c7b\u578b\u5c42\u9762\u6d88\u706d\u7a7a\u6307\u9488&#034;&#xff0c;\u638c\u63e1 Some \/ None\u3001isSome()\u3001match \u89e3\u6784\u3001?? \u7a7a\u5408\u5e76\u3001?. \u5b89\u5168\u8c03\u7528&#xff0c;\u4ee5\u53ca map \/ filter \/ flatMap \u4e09\u4e2a\u94fe\u5f0f\u5de5\u5177&#xff1b;\u6240\u6709 API \u5747\u5728\u4ed3\u9889 SDK 1.1.3 \u4e0b\u5b9e\u6d4b\u7f16\u8bd1\u8fd0\u884c&#xff0c;\u5e76\u6f84\u6e05\u7f51\u4e0a\u65e7\u6559\u7a0b\u91cc getOrElse\u3001?:\u3001?[ \u7b49\u5728\u672c\u7248\u672c\u6839\u672c\u4e0d\u5b58\u5728\u7684\u5199\u6cd5\u9677\u9631\u3002<\/p>\n<hr \/>\n<h3>\u76ee\u5f55&#xff08;\u7cfb\u5217\u5bfc\u822a&#xff09;<\/h3>\n<p>\u6574\u5957\u8def\u7ebf\u5171 7 \u4e2a\u6a21\u5757\u300130 \u8bfe&#xff0c;\u6309\u6bcf\u5468 2&#xff5e;3 \u8bfe\u7684\u8282\u594f&#xff0c;\u5927\u7ea6 2&#xff5e;3 \u4e2a\u6708\u53ef\u4ee5\u8d70\u5b8c\u4e00\u904d&#xff1a;<\/p>\n<table>\n<tr>\u6a21\u5757\u8bfe\u6b21\u5185\u5bb9<\/tr>\n<tbody>\n<tr>\n<td>\u4e00\u3001\u73af\u5883\u4e0e\u5165\u95e8<\/td>\n<td>01&#xff5e;05<\/td>\n<td>\u73af\u5883\u642d\u5efa\u4e0e Hello World\u3001\u53d8\u91cf\u4e0e\u57fa\u672c\u7c7b\u578b\u3001\u8fd0\u7b97\u7b26\u4e0e\u8f93\u5165\u8f93\u51fa\u3001\u5206\u652f\u3001\u5faa\u73af<\/td>\n<\/tr>\n<tr>\n<td>\u4e8c\u3001\u5e38\u7528\u7c7b\u578b\u4e0e\u6570\u636e\u7ec4\u7ec7<\/td>\n<td>06&#xff5e;10<\/td>\n<td>\u5b57\u7b26\u4e32\u3001\u6570\u7ec4\u4e0e\u533a\u95f4\u3001ArrayList\/HashMap\/HashSet\u3001\u53ef\u7a7a\u7c7b\u578b\u3001\u9519\u8bef\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td>\u4e09\u3001\u51fd\u6570\u4e0e\u51fd\u6570\u5f0f<\/td>\n<td>11&#xff5e;14<\/td>\n<td>\u51fd\u6570\u3001Lambda \u4e0e\u9ad8\u9636\u51fd\u6570\u3001\u95ed\u5305\u3001\u8fed\u4ee3\u5668\u4e0e\u60f0\u6027\u5e8f\u5217<\/td>\n<\/tr>\n<tr>\n<td>\u56db\u3001\u9762\u5411\u5bf9\u8c61\u4e0e\u7c7b\u578b\u7cfb\u7edf<\/td>\n<td>15&#xff5e;20<\/td>\n<td>struct\/class\u3001\u6784\u9020\u4e0e\u5c5e\u6027\u3001\u63a5\u53e3\u3001\u679a\u4e3e\u4e0e match \u6a21\u5f0f\u5339\u914d\u3001\u6cdb\u578b\u3001\u6269\u5c55<\/td>\n<\/tr>\n<tr>\n<td>\u4e94\u3001\u5de5\u7a0b\u5316\u4e0e\u6807\u51c6\u5e93<\/td>\n<td>21&#xff5e;25<\/td>\n<td>cjpm \u5305\u7ba1\u7406\u4e0e\u591a\u6587\u4ef6\u3001\u6587\u4ef6 IO\u3001JSON \u5904\u7406\u3001\u7f51\u7edc\u7f16\u7a0b\u3001\u5355\u5143\u6d4b\u8bd5<\/td>\n<\/tr>\n<tr>\n<td>\u516d\u3001\u5e76\u53d1\u7f16\u7a0b<\/td>\n<td>26&#xff5e;28<\/td>\n<td>\u7ebf\u7a0b\u3001Channel \u901a\u9053\u4e0e\u540c\u6b65\u539f\u8bed\u3001\u5e76\u53d1\u5b9e\u6218<\/td>\n<\/tr>\n<tr>\n<td>\u4e03\u3001\u9879\u76ee\u5b9e\u6218<\/td>\n<td>29&#xff5e;30<\/td>\n<td>\u547d\u4ee4\u884c\u5c0f\u5de5\u5177\u3001GeoJSON \u6570\u636e\u5904\u7406\u5b9e\u6218<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<li>\u73af\u5883\u642d\u5efa\u4e0e\u7b2c\u4e00\u4e2a\u4ed3\u9889\u7a0b\u5e8f<\/li>\n<li>\u53d8\u91cf\u4e0e\u5e38\u91cf&#xff1a;let \/ var \u4e0e\u57fa\u672c\u6570\u636e\u7c7b\u578b<\/li>\n<li>\u8fd0\u7b97\u7b26\u4e0e\u6807\u51c6\u8f93\u5165\u8f93\u51fa<\/li>\n<li>\u5206\u652f\u7ed3\u6784&#xff1a;if \u4e0e match \u8868\u8fbe\u5f0f<\/li>\n<li>\u5faa\u73af\u7ed3\u6784&#xff1a;while \/ for \/ Range<\/li>\n<li>\u5b57\u7b26\u4e32\u8be6\u89e3\u4e0e\u5b57\u7b26\u4e32\u63d2\u503c<\/li>\n<li>\u6570\u7ec4 Array \u4e0e\u533a\u95f4 Range<\/li>\n<li>\u96c6\u5408\u6846\u67b6&#xff1a;ArrayList\u3001HashMap\u3001HashSet<\/li>\n<li>\u53ef\u7a7a\u7c7b\u578b ? \u4e0e Option&#xff08;\u672c\u6587&#xff09;<\/li>\n<li>\u9519\u8bef\u5904\u7406&#xff1a;\u5f02\u5e38\u673a\u5236\u4e0e Result<\/li>\n<li>\u51fd\u6570\u5b9a\u4e49\u3001\u53c2\u6570\u4e0e\u8fd4\u56de\u503c<\/li>\n<li>Lambda \u4e0e\u9ad8\u9636\u51fd\u6570<\/li>\n<li>\u95ed\u5305\u3001\u4f5c\u7528\u57df\u4e0e\u51fd\u6570\u7c7b\u578b<\/li>\n<li>\u8fed\u4ee3\u5668 Iterator \u4e0e Sequence<\/li>\n<li>\u7ed3\u6784\u4f53 struct \u4e0e\u7c7b class<\/li>\n<li>\u6784\u9020\u51fd\u6570\u3001\u5c5e\u6027\u4e0e\u65b9\u6cd5<\/li>\n<li>\u63a5\u53e3 interface \u4e0e\u5b9e\u73b0<\/li>\n<li>\u679a\u4e3e enum\u3001\u4ee3\u6570\u6570\u636e\u7c7b\u578b\u4e0e match \u6a21\u5f0f\u5339\u914d<\/li>\n<li>\u6cdb\u578b\u7f16\u7a0b<\/li>\n<li>\u6269\u5c55\u3001\u7c7b\u578b\u522b\u540d\u4e0e\u53ef\u89c1\u6027\u63a7\u5236<\/li>\n<li>cjpm \u5305\u7ba1\u7406\u4e0e\u591a\u6587\u4ef6\u9879\u76ee\u7ec4\u7ec7<\/li>\n<li>\u6587\u4ef6\u4e0e\u76ee\u5f55 IO<\/li>\n<li>JSON \u5904\u7406&#xff08;\u7ed3\u5408 stdx \u6269\u5c55\u5e93&#xff09;<\/li>\n<li>\u7f51\u7edc\u7f16\u7a0b\u5165\u95e8<\/li>\n<li>\u5355\u5143\u6d4b\u8bd5<\/li>\n<li>\u5e76\u53d1\u57fa\u7840&#xff1a;\u7ebf\u7a0b\u7684\u521b\u5efa\u4e0e\u7b49\u5f85<\/li>\n<li>Channel \u901a\u9053\u4e0e\u540c\u6b65\u539f\u8bed<\/li>\n<li>\u5e76\u53d1\u5b9e\u6218&#xff1a;\u591a\u7ebf\u7a0b\u4efb\u52a1\u5904\u7406<\/li>\n<li>\u5b9e\u6218\u4e00&#xff1a;\u5e26\u6587\u4ef6\u6301\u4e45\u5316\u7684\u547d\u4ee4\u884c\u5c0f\u5de5\u5177<\/li>\n<li>\u5b9e\u6218\u4e8c&#xff1a;GeoJSON \u6570\u636e\u5904\u7406\u7a0b\u5e8f<\/li>\n<hr \/>\n<h3>\u4e00\u3001\u7a7a\u6307\u9488&#xff1a;\u56f0\u6270\u884c\u4e1a\u534a\u4e2a\u4e16\u7eaa\u7684&#034;\u70b8\u5f39&#034;<\/h3>\n<p>\u5b66\u8fc7 Java\u3001C\u3001JavaScript \u7684\u540c\u5b66\u591a\u534a\u89c1\u8fc7\u8fd9\u79cd\u5d29\u6e83&#xff1a;<\/p>\n<p>NullPointerException        \/\/ Java<br \/>\nCannot read property &#039;x&#039; of undefined   \/\/ JavaScript<br \/>\nSegmentation fault           \/\/ C<\/p>\n<p>\u6839\u6e90\u90fd\u4e00\u6837&#xff1a;\u4e00\u4e2a\u53d8\u91cf\u6709\u65f6\u6307\u5411\u771f\u5b9e\u6570\u636e&#xff0c;\u6709\u65f6\u662f\u4e00\u4e2a\u7279\u6b8a\u7684&#034;\u7a7a\u503c&#034;&#xff08;null \/ undefined&#xff09;&#xff0c;\u800c\u7f16\u8bd1\u5668\u4e0d\u63d0\u9192\u4f60&#xff0c;\u7b49\u7a0b\u5e8f\u8dd1\u5230\u90a3\u4e00\u884c\u624d\u7206\u70b8\u3002\u5b83\u88ab\u79f0\u4e3a&#034;\u4ef7\u503c\u5341\u4ebf\u7f8e\u5143\u7684\u9519\u8bef&#034;\u3002<\/p>\n<p>\u4ed3\u9889\u7684\u601d\u8def\u662f\u628a\u8bdd\u8bf4\u5728\u7c7b\u578b\u4e0a&#xff1a;<\/p>\n<ul>\n<li>\u4e00\u4e2a\u666e\u901a\u7684 Int64 \u53d8\u91cf&#xff0c;\u6c38\u8fdc\u6709\u503c&#xff0c;\u4f60\u4e0d\u53ef\u80fd\u628a&#034;\u7a7a&#034;\u585e\u7ed9\u5b83&#xff1b;<\/li>\n<li>\u5982\u679c\u67d0\u4e2a\u4e1c\u897f\u5141\u8bb8\u6ca1\u6709\u503c&#xff08;\u6bd4\u5982\u67e5\u5b57\u5178\u53ef\u80fd\u67e5\u4e0d\u5230\u3001\u6570\u7ec4\u53ef\u80fd\u8d8a\u754c\u3001\u7528\u6237\u53ef\u80fd\u6ca1\u586b\u6635\u79f0&#xff09;&#xff0c;\u5c31\u5fc5\u987b\u628a\u7c7b\u578b\u5199\u6210 ?Int64&#xff08;\u8bfb\u4f5c&#034;\u53ef\u7a7a\u7684 Int64&#034;&#xff09;&#xff1b;<\/li>\n<li>\u7c7b\u578b\u4e0a\u5e26\u4e86 ?&#xff0c;\u7f16\u8bd1\u5668\u5c31\u5f3a\u8feb\u4f60\u5148\u5904\u7406&#034;\u6ca1\u6709&#034;\u7684\u60c5\u51b5&#xff0c;\u5426\u5219\u7f16\u8bd1\u90fd\u8fc7\u4e0d\u4e86\u2014\u2014\u70b8\u5f39\u88ab\u63d0\u524d\u62c6\u9664\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u5c31\u662f\u672c\u8bfe\u7684\u4e3b\u89d2&#xff1a;\u53ef\u7a7a\u7c7b\u578b ?&#xff0c;\u4ee5\u53ca\u5b83\u80cc\u540e\u7684\u679a\u4e3e Option\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u8ba4\u8bc6 Option&#xff1a;Some \u4e0e None<\/h3>\n<p>?T \u662f Option&lt;T&gt; \u7684\u7b80\u5199&#xff0c;\u4e8c\u8005\u5b8c\u5168\u7b49\u4ef7\u3002\u4e00\u4e2a Option \u53ea\u6709\u4e24\u79cd\u72b6\u6001&#xff1a;<\/p>\n<ul>\n<li>Some(\u503c)&#xff1a;\u6709\u503c&#xff0c;\u771f\u5b9e\u6570\u636e\u5305\u5728\u62ec\u53f7\u91cc&#xff1b;<\/li>\n<li>None&#xff1a;\u6ca1\u6709\u503c\u3002<\/li>\n<\/ul>\n<p>\/\/ \u5728\u6570\u7ec4\u91cc\u627e\u7b2c\u4e00\u4e2a\u5076\u6570&#xff1a;\u627e\u5230\u8fd4\u56de Some&#xff0c;\u6ca1\u6709\u5076\u6570\u8fd4\u56de None<br \/>\nfunc firstEven(a: Array&lt;Int64&gt;): ?Int64 {<br \/>\n    for (x in a) {<br \/>\n        if (x % 2 &#061;&#061; 0) {<br \/>\n            return Some(x)<br \/>\n        }<br \/>\n    }<br \/>\n    return None<br \/>\n}<\/p>\n<p>main(): Int64 {<br \/>\n    \/\/ \u2460 \u4e24\u79cd\u58f0\u660e\u65b9\u5f0f\u5b8c\u5168\u7b49\u4ef7<br \/>\n    let a: ?Int64 &#061; Some(10)<br \/>\n    let b: Option&lt;Int64&gt; &#061; None<br \/>\n    println(&#034;a &#061; ${a}&#xff0c;b &#061; ${b}&#034;)<\/p>\n<p>    \/\/ \u2461 \u5224\u7a7a<br \/>\n    println(&#034;a&#xff1a;isSome&#061;${a.isSome()}&#xff0c;isNone&#061;${a.isNone()}&#034;)<br \/>\n    println(&#034;b&#xff1a;isSome&#061;${b.isSome()}&#xff0c;isNone&#061;${b.isNone()}&#034;)<\/p>\n<p>    \/\/ \u2462 \u786e\u5b9a\u6709\u503c\u518d\u53d6<br \/>\n    if (a.isSome()) {<br \/>\n        println(&#034;a \u91cc\u7684\u503c &#061; ${a.getOrThrow()}&#034;)<br \/>\n    }<\/p>\n<p>    \/\/ \u2463 ?? \u7a7a\u5408\u5e76&#xff1a;None \u65f6\u4f7f\u7528\u9ed8\u8ba4\u503c<br \/>\n    println(&#034;a ?? 0 &#061; ${a ?? 0}&#034;)<br \/>\n    println(&#034;b ?? 0 &#061; ${b ?? 0}&#034;)<\/p>\n<p>    \/\/ \u2464 \u51fd\u6570\u5b9e\u6218<br \/>\n    println(&#034;firstEven([1, 3, 4, 5]) &#061; ${firstEven([1, 3, 4, 5])}&#034;)<br \/>\n    println(&#034;firstEven([1, 3, 5])    &#061; ${firstEven([1, 3, 5])}&#034;)<br \/>\n    return 0<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff08;SDK 1.1.3 \u5b9e\u6d4b&#xff09;&#xff1a;<\/p>\n<p>a &#061; Some(10)&#xff0c;b &#061; None<br \/>\na&#xff1a;isSome&#061;true&#xff0c;isNone&#061;false<br \/>\nb&#xff1a;isSome&#061;false&#xff0c;isNone&#061;true<br \/>\na \u91cc\u7684\u503c &#061; 10<br \/>\na ?? 0 &#061; 10<br \/>\nb ?? 0 &#061; 0<br \/>\nfirstEven([1, 3, 4, 5]) &#061; Some(4)<br \/>\nfirstEven([1, 3, 5])    &#061; None<\/p>\n<p>\u4e09\u4e2a\u8981\u70b9&#xff1a;<\/p>\n<li>Some \u662f&#034;\u5feb\u9012\u76d2&#034;&#xff0c;\u503c\u8981\u62c6\u5f00\u624d\u80fd\u7528\u2014\u2014\u76f4\u63a5\u6253\u5370\u770b\u5230\u7684\u662f Some(10) \u800c\u4e0d\u662f 10&#xff1b;<\/li>\n<li>isSome() \/ isNone() \u662f\u4e24\u4e2a\u5224\u65ad\u65b9\u6cd5&#xff0c;\u8fd4\u56de Bool&#xff1b;<\/li>\n<li>getOrThrow() \u8d1f\u8d23\u62c6\u76d2&#xff1a;\u6709\u503c\u8fd4\u56de\u91cc\u9762\u7684\u503c&#xff1b;\u5bf9\u7740 None \u8c03\u7528\u4f1a\u629b NoneValueException&#xff0c;\u6240\u4ee5\u5b83\u524d\u9762\u901a\u5e38\u90fd\u6709\u5224\u65ad\u3002\u8fd9\u4e5f\u89e3\u91ca\u4e86\u7b2c 8 \u8bfe\u76f4\u63a5\u7528\u4e0b\u6807\u8bfb\u4e0d\u5b58\u5728\u7684 HashMap \u952e\u4e3a\u4ec0\u4e48\u70b8\u2014\u2014\u5e95\u5c42\u6b63\u662f\u8fd9\u4e2a\u5f02\u5e38\u3002<\/li>\n<p>\u26a0\ufe0f \u7279\u522b\u63d0\u9192&#xff1a;\u4ed3\u9889\u6ca1\u6709&#034;\u667a\u80fd\u8f6c\u6362&#034;\u3002\u5373\u4f7f\u4f60\u521a\u5199\u5b8c if (a.isSome()) { &#8230; }&#xff0c;\u62ec\u53f7\u91cc\u7684 a \u7c7b\u578b\u4f9d\u7136\u662f ?Int64&#xff0c;\u5fc5\u987b a.getOrThrow() \u663e\u5f0f\u53d6\u51fa\u3002\u628a\u53ef\u7a7a\u503c\u76f4\u63a5\u4f20\u7ed9\u8981\u975e\u7a7a\u503c\u7684\u51fd\u6570&#xff0c;\u7f16\u8bd1\u5668\u4f1a\u62a5 mismatched types\u2014\u2014\u8fd9\u6b63\u662f\u7c7b\u578b\u7cfb\u7edf\u5728\u4fdd\u62a4\u4f60\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u4e09\u79cd\u6b63\u786e\u7684&#034;\u62c6\u5305\u88f9&#034;\u59ff\u52bf<\/h3>\n<h4>3.1 \u59ff\u52bf\u4e00&#xff1a;isSome \u5224\u65ad &#043; getOrThrow<\/h4>\n<p>\u4e0a\u4e00\u8282\u5df2\u7ecf\u89c1\u8fc7&#xff0c;\u9002\u5408&#034;\u6709\u5c31\u5904\u7406&#xff0c;\u6ca1\u6709\u5c31\u7b97\u4e86&#034;\u7684\u7b80\u5355\u573a\u666f\u3002\u7f3a\u70b9\u662f\u5224\u65ad\u548c\u53d6\u503c\u5206\u4e24\u884c&#xff0c;\u5199\u591a\u4e86\u5570\u55e6\u3002<\/p>\n<h4>3.2 \u59ff\u52bf\u4e8c&#xff1a;match \u89e3\u6784&#xff08;\u6700\u63a8\u8350&#xff09;<\/h4>\n<p>\u7b2c 4 \u8bfe\u5b66\u7684 match \u5929\u751f\u9002\u5408 Option&#xff1a;\u4e24\u4e2a\u5206\u652f\u5fc5\u987b\u5199\u5168&#xff0c;\u6f0f\u5199\u4efb\u4f55\u4e00\u4e2a\u7f16\u8bd1\u4e0d\u8fc7&#xff0c;\u60f3\u5fd8\u8bb0\u5904\u7406 None \u90fd\u96be\u3002<\/p>\n<p>func describe(o: ?Int64): String {<br \/>\n    match (o) {<br \/>\n        case Some(v) &#061;&gt; &#034;\u62ff\u5230 ${v}&#034;<br \/>\n        case None &#061;&gt; &#034;\u5565\u4e5f\u6ca1\u6709&#034;<br \/>\n    }<br \/>\n}<\/p>\n<p>case Some(v) \u91cc\u7684 v \u76f4\u63a5\u5c31\u662f\u62c6\u5f00\u540e\u7684\u771f\u5b9e\u503c&#xff08;\u8fd9\u91cc\u662f Int64&#xff09;&#xff0c;\u4e0d\u9700\u8981\u518d getOrThrow()\u3002\u4e0a\u8282\u8bfe\u6210\u7ee9\u67e5\u8be2\u5b9e\u6218\u4f1a\u5927\u91cf\u4f7f\u7528\u8fd9\u79cd\u5199\u6cd5\u3002<\/p>\n<h4>3.3 \u59ff\u52bf\u4e09&#xff1a;?? \u7a7a\u5408\u5e76\u7ed9\u9ed8\u8ba4\u503c<\/h4>\n<p>\u53ea\u60f3\u5728 None \u65f6\u515c\u4e00\u4e2a\u9ed8\u8ba4\u503c&#xff0c;\u7528 ??&#xff08;\u4e24\u4e2a\u95ee\u53f7&#xff09;\u6700\u77ed&#xff1a;<\/p>\n<p>let a: ?Int64 &#061; Some(10)<br \/>\nlet b: ?Int64 &#061; None<br \/>\nprintln(a ?? 0)   \/\/ 10 \u2014\u2014 \u6709\u503c&#xff0c;\u7528\u76d2\u5b50\u91cc\u7684\u503c<br \/>\nprintln(b ?? 0)   \/\/ 0  \u2014\u2014 None&#xff0c;\u7528\u53f3\u8fb9\u7684\u9ed8\u8ba4\u503c<\/p>\n<p>&#x1f6ab; \u6ce8\u610f&#xff1a;\u4ed3\u9889\u7684\u7a7a\u5408\u5e76\u8fd0\u7b97\u7b26\u662f ??&#xff0c;\u4e0d\u662f\u67d0\u4e9b\u8bed\u8a00\u7684 ?:&#xff08;\u5199 ?: \u4f1a\u62a5 expected expression after &#039;?&#039;&#xff09;\u3002\u672c\u7248\u672c\u4e5f\u6ca1\u6709 getOrElse \/ orElse \u8fd9\u7c7b\u65b9\u6cd5\u2014\u2014\u65e7\u6559\u7a0b\u91cc\u51fa\u73b0\u8fd9\u4e9b\u540d\u5b57&#xff0c;\u4e00\u5f8b\u7528 ?? \u4ee3\u66ff\u3002<\/p>\n<p>\u4e09\u79cd\u59ff\u52bf\u5bf9\u7167\u8868&#xff1a;<\/p>\n<table>\n<tr>\u65b9\u5f0f\u9002\u7528\u573a\u666fNone \u65f6<\/tr>\n<tbody>\n<tr>\n<td>isSome() &#043; getOrThrow()<\/td>\n<td>\u7b80\u5355\u7684\u5c31\u5730\u5224\u65ad<\/td>\n<td>\u8df3\u8fc7\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td>match { Some \/ None }<\/td>\n<td>\u4e24\u79cd\u60c5\u51b5\u90fd\u8981\u505a\u4e0d\u540c\u7684\u4e8b&#xff08;\u63a8\u8350&#xff09;<\/td>\n<td>\u8d70 None \u5206\u652f<\/td>\n<\/tr>\n<tr>\n<td>opt ?? \u9ed8\u8ba4\u503c<\/td>\n<td>\u53ea\u60f3\u515c\u4e00\u4e2a\u9ed8\u8ba4\u503c<\/td>\n<td>\u7528\u9ed8\u8ba4\u503c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u56db\u3001\u5b89\u5168\u8c03\u7528 ?.&#xff1a;\u76d2\u5b50\u4e0d\u7528\u62c6&#xff0c;\u64cd\u4f5c\u81ea\u52a8\u4f20<\/h3>\n<p>\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u53ef\u80fd\u4e3a\u7a7a\u7684\u5b57\u7b26\u4e32&#xff0c;\u60f3\u53d6\u5b83\u7684\u957f\u5ea6\u3002\u6309\u8001\u529e\u6cd5\u5f97\u5148\u5224\u65ad\u518d\u62c6&#xff1b;\u4ed3\u9889\u63d0\u4f9b ?.&#xff08;\u95ee\u53f7\u52a0\u70b9&#xff09;\u5b89\u5168\u8c03\u7528&#xff1a;<\/p>\n<p>let s: ?String &#061; Some(&#034;hello&#034;)<br \/>\nlet n: ?String &#061; None<br \/>\nprintln(&#034;${s?.size}&#034;)   \/\/ Some(5)<br \/>\nprintln(&#034;${n?.size}&#034;)   \/\/ None<\/p>\n<p>\u89c4\u5219\u5f88\u597d\u8bb0&#xff1a;<\/p>\n<ul>\n<li>\u5de6\u8fb9\u662f Some \u2192 \u6b63\u5e38\u6267\u884c .size&#xff0c;\u7ed3\u679c\u518d\u5305\u4e00\u5c42 Some&#xff1b;<\/li>\n<li>\u5de6\u8fb9\u662f None \u2192 \u53f3\u8fb9\u6839\u672c\u4e0d\u6267\u884c&#xff0c;\u6574\u4e2a\u8868\u8fbe\u5f0f\u76f4\u63a5\u662f None\u3002<\/li>\n<\/ul>\n<p>\u94fe\u6761\u53ef\u4ee5\u4e00\u76f4\u70b9\u4e0b\u53bb&#xff0c;\u4efb\u4f55\u4e00\u73af\u662f None&#xff0c;\u6574\u6761\u94fe\u5b50\u77ed\u8def\u6210 None&#xff0c;\u7edd\u4e0d\u70b8\u7a0b\u5e8f&#xff1a;<\/p>\n<p>\/\/ \u7528\u6237\u53ef\u80fd\u67e5\u4e0d\u5230 -&gt; \u6635\u79f0\u53ef\u80fd\u6ca1\u6709 -&gt; \u60f3\u53d6\u6635\u79f0\u957f\u5ea6<br \/>\nprintln(&#034;${foundUser?.nickname?.size}&#034;)   \/\/ \u4efb\u4e00\u73af\u4e3a\u7a7a\u90fd\u662f None<\/p>\n<h4>4.1 \u4e00\u4e2a\u771f\u5b9e\u7684\u5751&#xff1a;?. \u9047\u4e0a\u672c\u8eab\u53ef\u7a7a\u7684\u5b57\u6bb5&#xff0c;\u4f1a&#034;\u5957\u4e24\u5c42\u76d2\u5b50&#034;<\/h4>\n<p>\u770b\u8fd9\u4e2a\u5b9e\u6d4b&#xff08;nickname \u5b57\u6bb5\u672c\u8eab\u5c31\u662f ?String&#xff09;&#xff1a;<\/p>\n<p>class User {<br \/>\n    let name: String<br \/>\n    let nickname: ?String<br \/>\n    init(name: String, nickname: ?String) {<br \/>\n        this.name &#061; name<br \/>\n        this.nickname &#061; nickname<br \/>\n    }<br \/>\n}<\/p>\n<table>\n<tr>\u8868\u8fbe\u5f0f\u7ed3\u679c\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>\u5f20\u4e09?.nickname<\/td>\n<td>Some(Some(\u5c0f\u4e09\u5b50))<\/td>\n<td>\u7528\u6237\u6709&#xff0c;\u6635\u79f0\u4e5f\u6709\u2014\u2014\u5957\u4e86\u4e24\u5c42<\/td>\n<\/tr>\n<tr>\n<td>\u674e\u56db?.nickname<\/td>\n<td>Some(None)<\/td>\n<td>\u7528\u6237\u6709&#xff0c;\u4f46\u4ed6\u6ca1\u586b\u6635\u79f0<\/td>\n<\/tr>\n<tr>\n<td>\u738b\u4e94?.nickname<\/td>\n<td>None<\/td>\n<td>\u6839\u672c\u6ca1\u8fd9\u4e2a\u7528\u6237<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6b64\u65f6\u76f4\u63a5 ?? &#034;\u9ed8\u8ba4&#034; \u4e0d\u7ba1\u7528&#xff1a;Some(None) \u672c\u8eab\u662f Some&#xff0c;?? \u8ba4\u4e3a&#034;\u6709\u503c&#034;&#xff0c;\u4f1a\u539f\u6837\u7ed9\u4f60\u5185\u5c42\u7684\u76d2\u5b50\u3002\u8981\u62cd\u5e73\u6210\u4e00\u5c42&#xff0c;\u7528\u4e0b\u4e00\u8282\u7684 flatMap\u3002<\/p>\n<hr \/>\n<h3>\u4e94\u3001Option \u5de5\u5177\u7bb1&#xff1a;map \/ filter \/ flatMap<\/h3>\n<p>\u8fd9\u4e09\u4e2a\u65b9\u6cd5\u90fd\u4e0d\u62c6\u76d2\u5b50&#xff0c;\u800c\u662f\u5728\u76d2\u5b50\u5916\u9762\u64cd\u4f5c&#xff0c;\u7ed3\u679c\u4ecd\u7136\u662f Option\u2014\u2014\u53ef\u4ee5\u653e\u5fc3\u94fe\u5f0f\u8c03\u7528&#xff08;Lambda \u8bed\u6cd5 { \u53c2\u6570 &#061;&gt; \u8868\u8fbe\u5f0f } \u7b2c 12 \u8bfe\u4f1a\u7ec6\u8bb2&#xff0c;\u8fd9\u91cc\u7167\u6284\u5373\u53ef&#xff09;\u3002<\/p>\n<h4>5.1 map&#xff1a;\u76d2\u5b50\u91cc\u7684\u503c\u505a\u4e2a\u53d8\u6362<\/h4>\n<p>let a: ?Int64 &#061; Some(10)<br \/>\nlet b: ?Int64 &#061; None<br \/>\nprintln(&#034;${a.map({ x &#061;&gt; x * 2 })}&#034;)   \/\/ Some(20)<br \/>\nprintln(&#034;${b.map({ x &#061;&gt; x * 2 })}&#034;)   \/\/ None<\/p>\n<p>Some(10) \u7ecf\u8fc7 map \u53d8\u6210 Some(20)&#xff1b;None \u7eb9\u4e1d\u4e0d\u52a8\u3002<\/p>\n<h4>5.2 filter&#xff1a;\u4e0d\u7b26\u5408\u6761\u4ef6\u5c31\u53d8\u6210 None<\/h4>\n<p>println(&#034;${a.filter({ x &#061;&gt; x &gt; 5 })}&#034;)     \/\/ Some(10)<br \/>\nprintln(&#034;${a.filter({ x &#061;&gt; x &gt; 100 })}&#034;)   \/\/ None<\/p>\n<h4>5.3 flatMap&#xff1a;\u4e13\u95e8\u5bf9\u4ed8&#034;\u5d4c\u5957\u76d2\u5b50&#034;<\/h4>\n<p>4.1 \u7684\u4e24\u5c42\u76d2\u5b50&#xff0c;\u7528 flatMap \u4e00\u5c42\u62cd\u5e73&#xff1a;<\/p>\n<p>let zs: ?User &#061; Some(User(&#034;\u5f20\u4e09&#034;, Some(&#034;\u5c0f\u4e09\u5b50&#034;)))<br \/>\nlet ls: ?User &#061; Some(User(&#034;\u674e\u56db&#034;, None))<br \/>\nlet ww: ?User &#061; None<\/p>\n<p>let n1 &#061; zs.flatMap({ u &#061;&gt; u.nickname })   \/\/ Some(\u5c0f\u4e09\u5b50)<br \/>\nlet n2 &#061; ls.flatMap({ u &#061;&gt; u.nickname })   \/\/ None<br \/>\nlet n3 &#061; ww.flatMap({ u &#061;&gt; u.nickname })   \/\/ None<br \/>\nprintln(&#034;${n1 ?? &#034;&#xff08;\u65e0\u540d&#xff09;&#034;}&#034;)   \/\/ \u5c0f\u4e09\u5b50<br \/>\nprintln(&#034;${n2 ?? &#034;&#xff08;\u65e0\u540d&#xff09;&#034;}&#034;)   \/\/ &#xff08;\u65e0\u540d&#xff09;<br \/>\nprintln(&#034;${n3 ?? &#034;&#xff08;\u65e0\u540d&#xff09;&#034;}&#034;)   \/\/ &#xff08;\u65e0\u540d&#xff09;<\/p>\n<p>\u8bb0\u5fc6\u65b9\u6cd5&#xff1a;map \u7528\u4e8e&#034;\u53d8\u6362\u503c&#034;&#xff0c;flatMap \u7528\u4e8e\u53d8\u6362\u51fd\u6570\u672c\u8eab\u4e5f\u8fd4\u56de Option \u7684\u573a\u666f&#xff08;\u987a\u624b\u62cd\u5e73\u4e00\u5c42&#xff09;\u3002<\/p>\n<p>&#x1f4cc; \u4e24\u4e2a\u5b9e\u6d4b\u5c0f\u5751&#xff08;\u90fd\u662f 1.1.3 \u771f\u5b9e\u8868\u73b0&#xff09;&#xff1a;<\/p>\n<li>map \/ filter \/ flatMap \u90fd\u5b58\u5728&#xff0c;\u4f46 andThen\u3001getOrElse\u3001orElse\u3001orElseGet\u3001unwrap \u5747\u4e0d\u5b58\u5728&#xff0c;\u7f51\u4e0a\u6587\u7ae0\u7528\u5230\u8fd9\u4e9b\u540d\u5b57\u65f6\u8bf7\u81ea\u884c\u7ffb\u8bd1\u4e3a flatMap \/ ?? \/ match\u3002<\/li>\n<li>?? \u76f4\u63a5\u63a5\u5728\u65b9\u6cd5\u8c03\u7528\u94fe\u540e\u9762\u6709\u65f6\u4f1a\u89e3\u6790\u5931\u8d25&#xff08;\u62a5 cannot use optional chaining&#xff09;&#xff0c;\u5148\u5b58\u6210\u4e00\u4e2a\u53d8\u91cf\u518d ?? \u6700\u7a33\u59a5&#xff1a;let g &#061; score.map({ s &#061;&gt; gradeOf(s) })   \/\/ \u5148\u5b58<br \/>\nprintln(g ?? &#034;\u7f3a\u8003&#034;)                      \/\/ \u518d\u5408\u5e76\n <\/li>\n<hr \/>\n<h3>\u516d\u3001Option \u5c31\u5728\u4f60\u8eab\u8fb9&#xff1a;\u6807\u51c6\u5e93\u7684&#034;\u5b89\u5168\u51fa\u53e3&#034;<\/h3>\n<p>\u5b66\u5b8c\u8fd9\u8282\u8bfe\u56de\u5934\u770b&#xff0c;\u7b2c 7\u30018 \u8bfe\u63a5\u89e6\u8fc7\u7684\u4e00\u6279\u65b9\u6cd5\u8fd4\u56de\u503c\u672c\u6765\u5c31\u662f Option\u2014\u2014\u5f53\u65f6\u89c9\u5f97\u5947\u602a\u7684\u8f93\u51fa&#xff0c;\u73b0\u5728\u5168\u90fd\u901a\u4e86&#xff1a;<\/p>\n<table>\n<tr>\u64cd\u4f5c\u8d8a\u754c\/\u67e5\u4e0d\u5230\u65f6\u7684\u884c\u4e3a\u8fd4\u56de\u7c7b\u578b<\/tr>\n<tbody>\n<tr>\n<td>\u6570\u7ec4[i] \/ ArrayList[i]&#xff08;\u65b9\u62ec\u53f7&#xff09;<\/td>\n<td>\u629b IndexOutOfBoundsException<\/td>\n<td>\u666e\u901a\u503c<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u7ec4.get(i) \/ list.get(i)<\/td>\n<td>\u5b89\u9759\u5730\u8fd4\u56de None<\/td>\n<td>?T<\/td>\n<\/tr>\n<tr>\n<td>map[key]&#xff08;\u65b9\u62ec\u53f7&#xff09;<\/td>\n<td>\u629b NoneValueException&#xff08;\u7b2c 8 \u8bfe\u5b9e\u6d4b&#xff09;<\/td>\n<td>\u666e\u901a\u503c<\/td>\n<\/tr>\n<tr>\n<td>map.get(key)<\/td>\n<td>\u5b89\u9759\u5730\u8fd4\u56de None<\/td>\n<td>?V<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e00\u53e5\u8bdd&#xff1a;\u65b9\u62ec\u53f7\u662f&#034;\u5feb\u901a\u9053&#034;&#xff0c;\u786e\u4fe1\u4e0b\u6807\/\u952e\u5b58\u5728\u65f6\u7528&#xff1b;get \u662f&#034;\u5b89\u5168\u901a\u9053&#034;&#xff0c;\u62ff\u4e0d\u51c6\u65f6\u7528\u3002<\/p>\n<h4>6.1 \u4e00\u4e2a\u610f\u5916\u53d1\u73b0&#xff1a;\u7f16\u8bd1\u5668\u4f1a\u66ff\u4f60\u67e5\u8d8a\u754c<\/h4>\n<p>\u5199\u4ee3\u7801\u65f6\u4f60\u53ef\u80fd\u4f1a\u649e\u5230\u8fd9\u4e2a\u62a5\u9519&#xff1a;<\/p>\n<p>error: array index is out of bounds<\/p>\n<p>\u4ed3\u9889\u4f1a\u5bf9\u7f16\u8bd1\u671f\u5c31\u80fd\u7b97\u51fa\u7684\u5e38\u91cf\u4e0b\u6807\u505a\u68c0\u67e5&#xff1a;let arr &#061; [1,2,3]; arr.get(9) \u751a\u81f3 arr[9]&#xff0c;\u7f16\u8bd1\u5668\u4e00\u773c\u770b\u51fa\u8d8a\u754c&#xff0c;\u76f4\u63a5\u62d2\u7edd\u7f16\u8bd1\u3002\u4e0b\u6807\u6765\u81ea\u5faa\u73af\u53d8\u91cf\u3001\u51fd\u6570\u53c2\u6570\u7b49&#034;\u8fd0\u884c\u65f6\u624d\u77e5\u9053&#034;\u7684\u503c\u65f6&#xff0c;\u624d\u7559\u5230\u8fd0\u884c\u671f\u5904\u7406\u3002\u8fd9\u662f\u52a0\u5206\u9879&#xff0c;\u4f46\u7b2c\u4e00\u6b21\u89c1\u4f1a\u61f5\u2014\u2014\u8bb0\u4f4f\u5b83\u4e0d\u662f bug\u3002<\/p>\n<h4>6.2 \u81ea\u5df1\u8bbe\u8ba1\u51fd\u6570&#xff1a;\u628a&#034;\u53ef\u80fd\u5931\u8d25&#034;\u5199\u8fdb\u8fd4\u56de\u7c7b\u578b<\/h4>\n<p>\u6700\u5b9e\u7528\u7684\u4e60\u60ef&#xff1a;\u51e1\u662f\u7ed3\u679c\u53ef\u80fd\u6ca1\u6709\u7684\u51fd\u6570&#xff0c;\u8ba9\u5b83\u8fd4\u56de ?T&#xff0c;\u8c03\u7528\u65b9\u5c31\u88ab\u8feb\u9762\u5bf9\u5931\u8d25&#xff0c;\u800c\u4e0d\u662f\u63a5\u5230\u4e00\u4e2a\u6084\u6084\u7206\u70b8\u7684 null\u3002\u6bd4\u5982\u9664\u96f6&#xff1a;<\/p>\n<p>func safeDiv(a: Float64, b: Float64): ?Float64 {<br \/>\n    if (b &#061;&#061; 0.0) {<br \/>\n        return None<br \/>\n    }<br \/>\n    return Some(a \/ b)<br \/>\n}<\/p>\n<p>\u8c03\u7528\u65b9\u60f3\u70b8\u90fd\u96be&#xff1a;safeDiv(10, 0) \u62ff\u5230\u7684\u662f None&#xff0c;\u914d\u5408 ?? \u6216 match \u5c31\u80fd\u4f18\u96c5\u515c\u5e95\u3002<\/p>\n<hr \/>\n<h3>\u4e03\u3001CIDE \u5b9e\u64cd&#xff1a;\u6210\u7ee9\u67e5\u8be2 &#043; \u5b66\u751f\u6635\u79f0&#xff08;\u7efc\u5408\u5b9e\u6218&#xff09;<\/h3>\n<h4>7.1 \u7f16\u5199\u7a0b\u5e8f<\/h4>\n<p>\u65b0\u5efa\u5de5\u7a0b&#xff08;\u6216\u5355\u6587\u4ef6&#xff09;&#xff0c;\u8f93\u5165\u4e0b\u9762\u7684\u7a0b\u5e8f\u3002\u5b83\u628a\u672c\u8282\u8bfe\u5168\u90e8\u8981\u7d20\u4e32\u4e86\u8d77\u6765&#xff1a;\u5b89\u5168\u9664\u6cd5\u3001HashMap \u67e5\u8be2\u3001match \u89e3\u6784\u3001map &#043; ?? \u4e00\u884c\u6d41\u3001\u5d4c\u5957 Option \u4e0e flatMap\u3001get \u8d8a\u754c\u4e0e\u65b9\u62ec\u53f7\u8d8a\u754c\u5bf9\u7167\u3002<\/p>\n<p>import std.collection.*<\/p>\n<p>\/\/ \u5b89\u5168\u9664\u6cd5&#xff1a;\u9664\u6570\u4e3a 0 \u65f6\u8fd4\u56de None&#xff0c;\u800c\u4e0d\u662f\u5d29\u6e83<br \/>\nfunc safeDiv(a: Float64, b: Float64): ?Float64 {<br \/>\n    if (b &#061;&#061; 0.0) {<br \/>\n        return None<br \/>\n    }<br \/>\n    return Some(a \/ b)<br \/>\n}<\/p>\n<p>class Student {<br \/>\n    let name: String<br \/>\n    let nickname: ?String  \/\/ \u6635\u79f0\u53ef\u4ee5\u6ca1\u6709<br \/>\n    init(name: String, nickname: ?String) {<br \/>\n        this.name &#061; name<br \/>\n        this.nickname &#061; nickname<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u6309\u59d3\u540d\u67e5\u5b66\u751f&#xff1a;\u53ef\u80fd\u67e5\u4e0d\u5230<br \/>\nfunc findStudent(list: ArrayList&lt;Student&gt;, target: String): ?Student {<br \/>\n    for (s in list) {<br \/>\n        if (s.name &#061;&#061; target) {<br \/>\n            return Some(s)<br \/>\n        }<br \/>\n    }<br \/>\n    return None<br \/>\n}<\/p>\n<p>\/\/ \u5206\u6570\u8bc4\u7ea7&#xff08;\u62ff\u5230\u7684\u4e00\u5b9a\u662f\u771f\u5b9e\u5206\u6570&#xff09;<br \/>\nfunc gradeOf(score: Int64): String {<br \/>\n    if (score &gt;&#061; 90) {<br \/>\n        return &#034;\u4f18\u79c0&#034;<br \/>\n    } else if (score &gt;&#061; 60) {<br \/>\n        return &#034;\u53ca\u683c&#034;<br \/>\n    } else {<br \/>\n        return &#034;\u4e0d\u53ca\u683c&#034;<br \/>\n    }<br \/>\n}<\/p>\n<p>main(): Int64 {<br \/>\n    println(&#034;&#8212;&#8212; \u2460 \u5b89\u5168\u9664\u6cd5 &#8212;&#8212;&#034;)<br \/>\n    let r1 &#061; safeDiv(10.0, 2.0)<br \/>\n    let r2 &#061; safeDiv(10.0, 0.0)<br \/>\n    println(&#034;10 \/ 2 &#061; ${r1}&#034;)<br \/>\n    println(&#034;10 \/ 0 &#061; ${r2}&#034;)<br \/>\n    println(&#034;\u5e73\u5747\u503c &#061; ${r2 ?? 0.0}&#034;)<\/p>\n<p>    println(&#034;&#8212;&#8212; \u2461 \u6210\u7ee9\u67e5\u8be2&#xff08;\u7f3a\u8003\u7684\u4eba\u4e0d\u5728\u8868\u91cc&#xff09;&#8212;&#8212;&#034;)<br \/>\n    let scores &#061; HashMap&lt;String, Int64&gt;()<br \/>\n    scores.add(&#034;\u5f20\u4e09&#034;, 92)<br \/>\n    scores.add(&#034;\u674e\u56db&#034;, 58)<br \/>\n    for (name in [&#034;\u5f20\u4e09&#034;, &#034;\u674e\u56db&#034;, &#034;\u738b\u4e94&#034;]) {<br \/>\n        let score &#061; scores.get(name)<br \/>\n        match (score) {<br \/>\n            case Some(s) &#061;&gt; println(&#034;${name}&#xff1a;${s} \u5206&#xff0c;${gradeOf(s)}&#034;)<br \/>\n            case None &#061;&gt; println(&#034;${name}&#xff1a;\u7f3a\u8003&#034;)<br \/>\n        }<br \/>\n    }<\/p>\n<p>    println(&#034;&#8212;&#8212; \u2462 \u4e00\u884c\u6d41&#xff1a;map \u53d8\u6362 &#043; ?? \u515c\u5e95 &#8212;&#8212;&#034;)<br \/>\n    for (name in [&#034;\u5f20\u4e09&#034;, &#034;\u674e\u56db&#034;, &#034;\u738b\u4e94&#034;]) {<br \/>\n        let g &#061; scores.get(name).map({ s &#061;&gt; gradeOf(s) })<br \/>\n        println(&#034;${name}&#xff1a;${g ?? &#034;\u7f3a\u8003&#034;}&#034;)<br \/>\n    }<\/p>\n<p>    println(&#034;&#8212;&#8212; \u2463 \u5b66\u751f\u6635\u79f0&#xff08;\u5d4c\u5957 Option \u4e0e flatMap&#xff09;&#8212;&#8212;&#034;)<br \/>\n    let students &#061; ArrayList&lt;Student&gt;([<br \/>\n        Student(&#034;\u5f20\u4e09&#034;, Some(&#034;\u5c0f\u4e09\u5b50&#034;)),<br \/>\n        Student(&#034;\u674e\u56db&#034;, None)<br \/>\n    ])<br \/>\n    for (name in [&#034;\u5f20\u4e09&#034;, &#034;\u674e\u56db&#034;, &#034;\u738b\u4e94&#034;]) {<br \/>\n        let nick &#061; findStudent(students, name).flatMap({ s &#061;&gt; s.nickname })<br \/>\n        println(&#034;${name} \u7684\u6635\u79f0&#xff1a;${nick ?? &#034;&#xff08;\u6ca1\u6709\u6635\u79f0&#xff09;&#034;}&#034;)<br \/>\n    }<\/p>\n<p>    println(&#034;&#8212;&#8212; \u2464 \u8d8a\u754c\u8bbf\u95ee&#xff1a;get \u8fd4\u56de None&#xff0c;[] \u76f4\u63a5\u629b\u5f02\u5e38 &#8212;&#8212;&#034;)<br \/>\n    let data &#061; [10, 20, 30]<br \/>\n    for (i in 0..data.size &#043; 1) {<br \/>\n        match (data.get(i)) {<br \/>\n            case Some(v) &#061;&gt; println(&#034;\u7b2c ${i} \u4e2a&#xff1a;${v}&#034;)<br \/>\n            case None &#061;&gt; println(&#034;\u7b2c ${i} \u4e2a&#xff1a;\u4e0d\u5b58\u5728&#xff08;\u4f46\u7a0b\u5e8f\u8fd8\u6d3b\u7740&#xff09;&#034;)<br \/>\n        }<br \/>\n    }<br \/>\n    \/\/ \u5bf9\u7167&#xff1a;\u65b9\u62ec\u53f7\u4e0b\u6807\u8d8a\u754c\u4f1a\u629b\u5f02\u5e38&#xff08;\u5305\u5728 try \u91cc\u7a0b\u5e8f\u624d\u4e0d\u4f1a\u9000\u51fa&#xff09;<br \/>\n    try {<br \/>\n        println(&#034;${atIndex(data, 3)}&#034;)<br \/>\n    } catch (e: IndexOutOfBoundsException) {<br \/>\n        println(&#034;\u65b9\u62ec\u53f7\u8d8a\u754c\u88ab\u6355\u83b7&#xff1a;${e}&#034;)<br \/>\n    }<br \/>\n    return 0<br \/>\n}<\/p>\n<p>\/\/ \u4e0b\u6807\u5305\u8fdb\u51fd\u6570&#xff0c;\u9694\u7edd\u7f16\u8bd1\u5668\u5bf9\u5b57\u9762\u91cf\u4e0b\u6807\u7684\u7f16\u8bd1\u671f\u68c0\u67e5<br \/>\nfunc atIndex(a: Array&lt;Int64&gt;, i: Int64): Int64 {<br \/>\n    return a[i]<br \/>\n}<\/p>\n<p>&#x1f4a1; \u5c0f\u63d0\u793a&#xff1a;Lambda \u91cc\u5982\u679c\u7528 if \u8868\u8fbe\u5f0f\u4e14\u5199\u5728\u540c\u4e00\u884c&#xff0c;\u4e24\u4e2a\u5206\u652f\u4f53\u90fd\u8981\u5e26\u82b1\u62ec\u53f7&#xff1a;{ s &#061;&gt; if (s &gt;&#061; 60) { &#034;\u53ca\u683c&#034; } else { &#034;\u4e0d\u53ca\u683c&#034; } }&#xff0c;\u5426\u5219\u4f1a\u62a5 expected &#039;{&#039;\u3002<\/p>\n<h4>7.2 \u8fd0\u884c\u4e0e\u9a8c\u8bc1<\/h4>\n<p>\u5728 CIDE \u4e2d\u70b9\u8fd0\u884c&#xff08;\u6216 cjpm run&#xff09;&#xff0c;\u5e94\u5f97\u5230\u4e0b\u9762\u7684\u8f93\u51fa&#xff08;\u5df2\u9010\u5b57\u6838\u5bf9&#xff09;&#xff1a;<\/p>\n<p>&#8212;&#8212; \u2460 \u5b89\u5168\u9664\u6cd5 &#8212;&#8212;<br \/>\n10 \/ 2 &#061; Some(5.000000)<br \/>\n10 \/ 0 &#061; None<br \/>\n\u5e73\u5747\u503c &#061; 0.000000<br \/>\n&#8212;&#8212; \u2461 \u6210\u7ee9\u67e5\u8be2&#xff08;\u7f3a\u8003\u7684\u4eba\u4e0d\u5728\u8868\u91cc&#xff09;&#8212;&#8212;<br \/>\n\u5f20\u4e09&#xff1a;92 \u5206&#xff0c;\u4f18\u79c0<br \/>\n\u674e\u56db&#xff1a;58 \u5206&#xff0c;\u4e0d\u53ca\u683c<br \/>\n\u738b\u4e94&#xff1a;\u7f3a\u8003<br \/>\n&#8212;&#8212; \u2462 \u4e00\u884c\u6d41&#xff1a;map \u53d8\u6362 &#043; ?? \u515c\u5e95 &#8212;&#8212;<br \/>\n\u5f20\u4e09&#xff1a;\u4f18\u79c0<br \/>\n\u674e\u56db&#xff1a;\u4e0d\u53ca\u683c<br \/>\n\u738b\u4e94&#xff1a;\u7f3a\u8003<br \/>\n&#8212;&#8212; \u2463 \u5b66\u751f\u6635\u79f0&#xff08;\u5d4c\u5957 Option \u4e0e flatMap&#xff09;&#8212;&#8212;<br \/>\n\u5f20\u4e09 \u7684\u6635\u79f0&#xff1a;\u5c0f\u4e09\u5b50<br \/>\n\u674e\u56db \u7684\u6635\u79f0&#xff1a;&#xff08;\u6ca1\u6709\u6635\u79f0&#xff09;<br \/>\n\u738b\u4e94 \u7684\u6635\u79f0&#xff1a;&#xff08;\u6ca1\u6709\u6635\u79f0&#xff09;<br \/>\n&#8212;&#8212; \u2464 \u8d8a\u754c\u8bbf\u95ee&#xff1a;get \u8fd4\u56de None&#xff0c;[] \u76f4\u63a5\u629b\u5f02\u5e38 &#8212;&#8212;<br \/>\n\u7b2c 0 \u4e2a&#xff1a;10<br \/>\n\u7b2c 1 \u4e2a&#xff1a;20<br \/>\n\u7b2c 2 \u4e2a&#xff1a;30<br \/>\n\u7b2c 3 \u4e2a&#xff1a;\u4e0d\u5b58\u5728&#xff08;\u4f46\u7a0b\u5e8f\u8fd8\u6d3b\u7740&#xff09;<br \/>\n\u65b9\u62ec\u53f7\u8d8a\u754c\u88ab\u6355\u83b7&#xff1a;IndexOutOfBoundsException: The length of the array is 3, but the index is 3.<\/p>\n<p>\u53ef\u4ee5\u81ea\u5df1\u52a8\u624b\u6539&#xff1a;<\/p>\n<ul>\n<li>\u628a \u2460 \u7684 r2 ?? 0.0 \u6539\u6210\u76f4\u63a5\u63d2\u503c\u6253\u5370 r2&#xff0c;\u4f53\u4f1a&#034;\u9ed8\u8ba4\u503c&#034;\u548c&#034;\u76d2\u5b50&#034;\u7684\u663e\u793a\u5dee\u522b&#xff1b;<\/li>\n<li>\u5728 \u2461 \u91cc\u628a match \u8bef\u5220 case None \u5206\u652f&#xff0c;\u7f16\u8bd1\u5668\u4f1a\u7acb\u523b\u62a5\u9519\u2014\u2014\u4eb2\u773c\u770b\u770b Option \u662f\u600e\u4e48&#034;\u903c\u7740&#034;\u4f60\u5904\u7406\u7f3a\u8003\u7684&#xff1b;<\/li>\n<li>\u628a \u2463 \u7684 flatMap \u6362\u6210 ?.&#xff0c;\u89c2\u5bdf\u8f93\u51fa\u5982\u4f55\u9000\u5316\u6210 Some(Some(&#8230;)) \/ Some(None)&#xff1b;<\/li>\n<li>\u7ed9 scores \u518d\u52a0\u4e00\u4e2a&#034;\u8d75\u516d&#034;35 \u5206&#xff0c;\u786e\u8ba4 \u2462 \u7684\u4e00\u884c\u6d41\u65e0\u9700\u4efb\u4f55\u4fee\u6539\u5c31\u6b63\u786e\u8f93\u51fa\u8bc4\u7ea7\u3002<\/li>\n<\/ul>\n<h4>7.3 \u7528\u8c03\u8bd5\u5668\u770b\u6e05 Some \u76d2\u5b50<\/h4>\n<p>Option \u5728 CIDE \u8c03\u8bd5\u5668\u91cc\u662f\u900f\u660e\u7684&#xff1a;<\/p>\n<li>\u5728 \u2461 \u7684 match (score) \u4e00\u884c\u6253\u65ad\u70b9&#xff0c;Shift &#043; F9 \u542f\u52a8\u8c03\u8bd5&#xff1b;<\/li>\n<li>Variables \u9762\u677f\u91cc score \u76f4\u63a5\u663e\u793a\u4e3a Some(92)&#xff1b;\u5faa\u73af\u5230\u738b\u4e94\u65f6\u53d8\u6210 None&#xff0c;\u4e0b\u65b9\u884c\u5185\u503c\u4e5f\u540c\u6b65\u53d8\u5316&#xff1b;<\/li>\n<li>\u5355\u6b65&#xff08;F8&#xff09;\u8fdb\u5165 case Some(s) \u5206\u652f\u65f6&#xff0c;\u80fd\u770b\u5230\u65b0\u53d8\u91cf s &#061; 92\u2014\u2014\u8fd9\u5c31\u662f match \u5e2e\u4f60\u62c6\u597d\u7684\u76d2\u5b50&#xff1b;<\/li>\n<li>\u5728 \u2463 \u65ad\u4f4f&#xff0c;\u5206\u522b\u5bf9\u6bd4 ?. \u5199\u6cd5&#xff08;\u5d4c\u5957\u4e24\u5c42&#xff09;\u4e0e flatMap \u5199\u6cd5&#xff08;\u53ea\u6709\u4e00\u5c42&#xff09;\u5728\u53d8\u91cf\u9762\u677f\u4e2d\u7684\u7ed3\u6784\u5dee\u5f02\u3002<\/li>\n<p>\u8c03\u8bd5\u7ed3\u675f\u70b9\u505c\u6b62\u6309\u94ae\u3002<\/p>\n<hr \/>\n<h3>\u516b\u3001\u5e38\u89c1\u95ee\u9898 FAQ<\/h3>\n<p>Q1&#xff1a;\u7f51\u4e0a\u6559\u7a0b\u5199\u7684 getOrElse(0)\u3001orElse { } \u4e3a\u4ec0\u4e48\u62a5 \u201cnot a member of enum \u2018Option\u2019\u201d&#xff1f; SDK 1.1.3 \u7684 Option \u6ca1\u6709\u8fd9\u4e9b\u65b9\u6cd5\u3002\u8981\u9ed8\u8ba4\u503c\u4e00\u5f8b\u7528 ??&#xff1b;\u8981\u6309\u60c5\u51b5\u5904\u7406\u7528 match&#xff1b;\u8981\u53d8\u6362\u7528 map&#xff1b;\u8981\u94fe\u5f0f\u62cd\u5e73\u7528 flatMap\u3002\u672c\u6587\u6240\u6709\u5199\u6cd5\u5747\u6309 1.1.3 \u5b9e\u6d4b\u3002<\/p>\n<p>Q2&#xff1a;\u7a7a\u5408\u5e76\u8fd0\u7b97\u7b26\u5230\u5e95\u662f ?: \u8fd8\u662f ??&#xff1f; ??&#xff08;\u4e24\u4e2a\u95ee\u53f7&#xff09;\u3002\u4ed3\u9889\u6ca1\u6709 ?: \u5199\u6cd5&#xff0c;\u5199\u4e86\u4f1a\u62a5 expected expression after &#039;?&#039;\u3002<\/p>\n<p>Q3&#xff1a;\u5b89\u5168\u4e0b\u6807 arr?[9] \u5b58\u5728\u5417&#xff1f; 1.1.3 \u4e0d\u652f\u6301&#xff0c;\u5199\u4e86\u62a5 cannot use optional chaining\u3002\u8981\u5b89\u5168\u8bbf\u95ee\u4e0b\u6807\u7edf\u4e00\u7528 arr.get(i)&#xff08;\u8d8a\u754c\u8fd4\u56de None&#xff09;\u3002<\/p>\n<p>Q4&#xff1a;\u4e3a\u4ec0\u4e48 x.field \u6253\u5370\u51fa Some(Some(&#8230;)) \u8fd9\u79cd\u53cc\u5c42\u76d2\u5b50&#xff1f; \u56e0\u4e3a x \u672c\u8eab\u662f Option\u3001field \u53c8\u6070\u597d\u662f\u53ef\u7a7a\u7c7b\u578b&#xff0c;?. \u53ea\u8d1f\u8d23\u8df3\u8fc7\u7b2c\u4e00\u5c42 None&#xff0c;\u4e0d\u4f1a\u81ea\u52a8\u62cd\u5e73\u3002\u7528 flatMap \u628a\u4e24\u5c42\u5408\u6210\u4e00\u5c42&#xff08;\u89c1 4.1\u30015.3&#xff09;\u3002<\/p>\n<p>Q5&#xff1a;\u660e\u660e if (o.isSome()) \u5224\u65ad\u8fc7\u4e86&#xff0c;\u4e3a\u4ec0\u4e48\u5206\u652f\u91cc\u7528 o \u8fd8\u62a5\u7c7b\u578b\u9519\u8bef&#xff1f; \u4ed3\u9889\u4e0d\u505a&#034;\u667a\u80fd\u8f6c\u6362&#034;&#xff0c;\u5224\u65ad\u4e0d\u4f1a\u6539\u53d8\u53d8\u91cf\u7684\u9759\u6001\u7c7b\u578b\u3002\u5206\u652f\u91cc\u7528 o.getOrThrow() \u663e\u5f0f\u53d6\u503c\u3002\u628a\u53ef\u7a7a\u503c\u76f4\u63a5\u4f20\u7ed9\u8981\u6c42\u975e\u7a7a\u7684\u51fd\u6570&#xff0c;\u4e5f\u4f1a\u5f97\u5230 mismatched types\u3002<\/p>\n<p>Q6&#xff1a;None.getOrThrow() \u4f1a\u600e\u6837&#xff1f; \u629b NoneValueException&#xff08;\u5bf9\u8c61\u672c\u8eab\u6253\u5370\u4e3a NoneValueException&#xff0c;\u65e0\u989d\u5916\u63cf\u8ff0\u6587\u672c&#xff09;\u3002\u7b2c 8 \u8bfe\u7528\u65b9\u62ec\u53f7\u8bfb\u4e0d\u5b58\u5728\u7684 HashMap \u952e\u89c1\u5230\u7684 Value does not exist! \u540c\u6e90\u3002\u6b63\u5e38\u4ee3\u7801\u91cc\u5e94\u5148\u7528 isSome() \/ match \/ ?? \u89c4\u907f&#xff0c;\u800c\u4e0d\u662f\u4f9d\u8d56 catch\u3002<\/p>\n<p>Q7&#xff1a;arr.get(9) \u4e3a\u4ec0\u4e48\u7f16\u8bd1\u9636\u6bb5\u5c31\u62a5 \u201carray index is out of bounds\u201d&#xff1f; \u7f16\u8bd1\u5668\u80fd\u5bf9\u5b57\u9762\u91cf\u6570\u7ec4 &#043; \u5e38\u91cf\u4e0b\u6807\u505a\u7f16\u8bd1\u671f\u6c42\u503c\u5e76\u62e6\u622a\u3002\u4e0b\u6807\u6765\u81ea\u5faa\u73af\u53d8\u91cf\u6216\u51fd\u6570\u53c2\u6570\u65f6\u624d\u7559\u5230\u8fd0\u884c\u671f&#xff08;6.1 \u8282&#xff09;\u3002\u8fd9\u662f\u5b89\u5168\u7279\u6027&#xff0c;\u4e0d\u662f\u7f16\u8bd1\u5668\u51fa\u9519\u3002<\/p>\n<p>Q8&#xff1a;Option \u548c\u4e0b\u8282\u8bfe\u7684 Result \u6709\u4ec0\u4e48\u533a\u522b&#xff1f; Option \u53ea\u56de\u7b54&#034;\u6709\u6ca1\u6709&#034;\u2014\u2014None \u4e0d\u643a\u5e26\u4efb\u4f55\u4fe1\u606f&#xff1b;\u4f46\u5f88\u591a\u5931\u8d25\u8fd8\u9700\u8981\u8bf4\u660e&#034;\u4e3a\u4ec0\u4e48\u5931\u8d25&#034;&#xff08;\u6587\u4ef6\u4e0d\u5b58\u5728&#xff1f;\u6743\u9650\u4e0d\u591f&#xff1f;\u683c\u5f0f\u9519\u8bef&#xff1f;&#xff09;\u3002\u7b2c 10 \u8bfe\u7684 Result&lt;T, E&gt; \u7528 Ok(\u503c) \/ Err(\u539f\u56e0) \u8868\u8fbe\u8fd9\u79cd\u573a\u666f&#xff0c;\u914d\u5408\u5f02\u5e38\u673a\u5236\u4e00\u8d77\u5b66\u3002<\/p>\n<hr \/>\n<h3>\u4e5d\u3001\u8bfe\u540e\u7ec3\u4e60<\/h3>\n<li>\u5b9e\u73b0 func indexOf(a: Array&lt;Int64&gt;, target: Int64): ?Int64&#xff1a;\u8fd4\u56de\u76ee\u6807\u7b2c\u4e00\u6b21\u51fa\u73b0\u7684\u4e0b\u6807&#xff08;Some(\u4e0b\u6807)&#xff09;&#xff0c;\u627e\u4e0d\u5230\u8fd4\u56de None\u3002\u7528\u6570\u7ec4 [5, 2, 9, 1, 5, 6] \u6d4b\u8bd5\u67e5\u627e 9 \u4e0e 100&#xff0c;\u5e76\u7528 ?? -1 \u6253\u5370&#034;\u627e\u4e0d\u5230\u65f6\u663e\u793a -1&#034;\u7684\u98ce\u683c\u5316\u7ed3\u679c\u3002<\/li>\n<li>\u7ed9\u7b2c 8 \u8bfe\u7684\u901a\u8baf\u5f55\u52a0\u4e00\u4e2a\u5b89\u5168\u67e5\u8be2\u51fd\u6570 findPhone(map, name)&#xff0c;\u5185\u90e8\u7528 get &#043; match&#xff1a;\u6709\u53f7\u7801\u6253\u5370\u53f7\u7801&#xff0c;\u6ca1\u6709\u65f6\u6253\u5370&#034;\u67e5\u65e0\u6b64\u4eba&#034;\u3002\u6545\u610f\u67e5\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u540d\u5b57\u9a8c\u8bc1\u4e0d\u4f1a\u5d29\u3002<\/li>\n<li>\u7528 map &#043; ?? \u4e00\u884c\u5b8c\u6210&#xff1a;\u7ed9\u5b9a let age: ?Int64&#xff08;\u5206\u522b\u8bd5 Some(17)\u3001Some(20)\u3001None&#xff09;&#xff0c;\u8f93\u51fa&#034;\u6210\u5e74&#034;\/\u201c\u672a\u6210\u5e74\u201d\/\u201c\u5e74\u9f84\u672a\u77e5\u201d\u3002<\/li>\n<li>\u5b9a\u4e49 class Book&#xff0c;\u542b\u53ef\u7a7a\u5b57\u6bb5 borrower: ?String&#xff08;\u501f\u9605\u4eba&#xff0c;\u6ca1\u4eba\u501f\u65f6\u4e3a None&#xff09;&#xff1b;\u51c6\u5907\u4e00\u4e2a\u8fd4\u56de ?Book \u7684\u67e5\u8be2\u51fd\u6570&#xff0c;\u7528 flatMap \u53d6\u51fa\u5f53\u524d\u501f\u9605\u4eba\u59d3\u540d\u5e76\u6253\u5370&#xff0c;\u6ca1\u4eba\u501f\u6216\u4e66\u4e0d\u5b58\u5728\u65f6\u7edf\u4e00\u663e\u793a&#034;\u5728\u9986\u53ef\u501f&#034;\u3002<\/li>\n<li>\u6253\u5f00 7.1 \u7684\u7a0b\u5e8f Shift &#043; F9 \u8c03\u8bd5&#xff0c;\u5728\u5faa\u73af\u4e2d\u89c2\u5bdf score \u5728 Some(&#8230;) \u4e0e None \u95f4\u7684\u53d8\u5316&#xff1b;\u518d\u5230 \u2463 \u5bf9\u6bd4 ?.nickname \u4e0e flatMap \u540e\u53d8\u91cf\u7684\u5c42\u6570\u5dee\u5f02&#xff0c;\u622a\u56fe\u6216\u53e3\u8ff0\u4e24\u8005\u533a\u522b\u3002<\/li>\n<hr \/>\n<h3>\u4e0b\u8282\u9884\u544a<\/h3>\n<p>Option \u89e3\u51b3\u4e86&#034;\u6709\u6ca1\u6709\u503c&#034;&#xff0c;\u4f46\u5b83\u6709\u4e2a\u76f2\u533a&#xff1a;None \u53ea\u80fd\u8868\u793a&#034;\u6ca1\u6709&#034;&#xff0c;\u8bf4\u4e0d\u51fa\u4e3a\u4ec0\u4e48\u6ca1\u6709\u3002\u6587\u4ef6\u8bfb\u4e0d\u5230\u3001\u7f51\u7edc\u5931\u8d25\u3001JSON \u683c\u5f0f\u9519\u8bef\u2014\u2014\u8fd9\u4e9b\u573a\u666f\u6211\u4eec\u8fd8\u60f3\u5e26\u4e0a\u539f\u56e0\u751a\u81f3\u9519\u8bef\u7801\u3002\u7b2c 10 \u8bfe\u5b66\u4e60\u9519\u8bef\u5904\u7406&#xff1a;\u5f02\u5e38\u673a\u5236\u4e0e Result&#xff1a;throw \/ try-catch \u600e\u4e48\u7528&#xff0c;Result&lt;T, E&gt; \u5982\u4f55\u628a\u9519\u8bef\u4e5f\u53d8\u6210\u7f16\u8bd1\u5668\u5e2e\u4f60\u68c0\u67e5\u7684\u8fd4\u56de\u503c&#xff0c;\u4ee5\u53ca\u4ed3\u9889&#034;\u5f02\u5e38 &#043; Result&#034;\u53cc\u8f68\u5236\u5404\u81ea\u9002\u5408\u4ec0\u4e48\u573a\u666f\u3002\u6211\u4eec\u4e0b\u8282\u8bfe\u89c1&#xff01;<\/p>\n<hr \/>\n<p>\u7cfb\u5217\u8bf4\u660e&#xff1a;\u672c\u7cfb\u5217\u57fa\u4e8e Windows \u5e73\u53f0 &#043; CIDE &#043; \u4ed3\u9889 SDK&#xff08;1.1.3&#xff09;\u7f16\u5199&#xff0c;\u6240\u6709\u4ee3\u7801\u5747\u5df2\u5b9e\u9645\u7f16\u8bd1\u8fd0\u884c\u901a\u8fc7\u3002\u5982\u9047 SDK \u7248\u672c\u5dee\u5f02\u5bfc\u81f4\u7684\u7ec6\u8282\u51fa\u5165&#xff0c;\u4ee5\u4f60\u672c\u5730\u7248\u672c\u4e3a\u51c6&#xff0c;\u6b22\u8fce\u8bc4\u8bba\u533a\u4ea4\u6d41\u3002<\/p>\n<hr \/>\n<p>\u79bb\u7ebf\u73af\u5883\u4e0b\u56fe\u7247\u53ef\u80fd\u52a0\u8f7d\u4e0d\u51fa\u6765&#xff0c;\u4e5f\u53ef\u4ee5\u5728 CIDE \u83dc\u5355 Help \u25b8 \u8054\u7cfb\u4f5c\u8005 \/ Contact \u4e2d\u67e5\u770b\u540c\u4e00\u5f20\u4e8c\u7ef4\u7801&#xff08;\u5e94\u7528\u5185\u7f6e\u515c\u5e95\u56fe&#xff0c;\u65e0\u9700\u8054\u7f51&#xff09;\u3002<\/p>\n<hr \/>\n<h3>&#x1f4e5; \u5de5\u5177\u4e0b\u8f7d<\/h3>\n<p>\u672c\u7cfb\u5217\u5168\u7a0b\u4f7f\u7528\u7684\u4ed3\u9889 IDE \u2014\u2014 CIDE&#xff08;\u514d\u8d39\u5f00\u6e90\u3001\u793e\u533a\u7248&#xff09;&#xff1a;<\/p>\n<ul>\n<li>GitCode \u4ed3\u5e93 \/ \u5b89\u88c5\u5305\u4e0b\u8f7d&#xff1a;https:\/\/gitcode.com\/wp_upala\/cide<\/li>\n<li>\u6253\u5f00\u9875\u9762\u540e\u8fdb\u5165 \u53d1\u884c\u7248&#xff08;Releases&#xff09;&#xff0c;\u4e24\u79cd\u5305\u4efb\u9009\u5176\u4e00&#xff1a;\n<ul>\n<li>\u5b89\u88c5\u7248&#xff1a;\u4e0b\u8f7d CIDE-&lt;\u7248\u672c&gt;-x64-Setup.exe&#xff0c;\u53cc\u51fb\u5b89\u88c5&#xff0c;\u9002\u5408\u65e5\u5e38\u957f\u671f\u4f7f\u7528&#xff1b;<\/li>\n<li>\u514d\u5b89\u88c5\u7248&#xff08;Portable&#xff09;&#xff1a;\u4e0b\u8f7d CIDE-&lt;\u7248\u672c&gt;-x64-Portable.zip&#xff0c;\u89e3\u538b\u5230\u4efb\u610f\u76ee\u5f55\u5373\u7528&#xff0c;\u4e0d\u5199\u6ce8\u518c\u8868\u3001\u4e0d\u7559\u5b89\u88c5\u75d5\u8ff9&#xff0c;\u62f7\u5230 U \u76d8\u4e5f\u80fd\u5728\u522b\u7684\u7535\u8111\u76f4\u63a5\u8fd0\u884c&#xff08;\u5305\u5185\u9644\u300a\u4f7f\u7528\u8bf4\u660e.txt\u300b&#xff09;\u3002\u9002\u5408\u5148\u8bd5\u7528\u3001\u6216\u5728\u53d7\u9650\u7535\u8111\u4e0a\u5b66\u4e60\u672c\u7cfb\u5217\u8bfe\u7a0b\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u4ed3\u9889 SDK \u8bf7\u524d\u5f80\u4ed3\u9889\u7f16\u7a0b\u8bed\u8a00\u5b98\u7f51\u4e0b\u8f7d&#xff1a;https:\/\/cangjie-lang.cn<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011\u53ef\u7a7a\u7c7b\u578b ? \u4e0e Option&#xff1a;\u8ba9\\&#8221;\u6ca1\u6709\u503c\\&#8221;\u65e0\u6cd5\u4f24\u4eba \u4e0a\u8282\u8bfe\u6211\u4eec\u5728 HashMap \u7684\u8f93\u51fa\u91cc\u53cd\u590d\u770b\u5230 Some(138-0000-0001)\u3001NoneValueException: Value does not exist!\u2014\u2014\u5f53\u65f6\u53ea\u7559\u4e86\u53e5\\&#8221;\u7b2c 9 \u8bfe\u8bb2\\&#8221;\u3002\u8fd9\u8282\u8bfe\u5c31\u6765\u6b63\u5f0f\u8ba4\u8bc6\u5b83\u4eec\u80cc\u540e\u7684\u8bbe\u8ba1&#xff1a;\u53ef\u7a7a\u7c7b\u578b ? \u4e0e Option\u3002 \u672c\u6587\u662f\u7cfb\u5217\u7b2c 9 \u8bfe&#xff1a;\u7406\u89e3\u4ed3\u9889\u4e3a\u4ec0\u4e48\u6562\u8bf4\\&#8221;\u4ece\u7c7b\u578b\u5c42\u9762\u6d88\u706d\u7a7a\u6307\u9488\\&#8221;&#xff0c;\u638c\u63e1<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[70,227],"topic":[],"class_list":["post-106763","post","type-post","status-publish","format-standard","hentry","category-server","tag-ide","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/106763.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011\u53ef\u7a7a\u7c7b\u578b ? \u4e0e Option&#xff1a;\u8ba9&quot;\u6ca1\u6709\u503c&quot;\u65e0\u6cd5\u4f24\u4eba \u4e0a\u8282\u8bfe\u6211\u4eec\u5728 HashMap \u7684\u8f93\u51fa\u91cc\u53cd\u590d\u770b\u5230 Some(138-0000-0001)\u3001NoneValueException: Value does not exist!\u2014\u2014\u5f53\u65f6\u53ea\u7559\u4e86\u53e5&quot;\u7b2c 9 \u8bfe\u8bb2&quot;\u3002\u8fd9\u8282\u8bfe\u5c31\u6765\u6b63\u5f0f\u8ba4\u8bc6\u5b83\u4eec\u80cc\u540e\u7684\u8bbe\u8ba1&#xff1a;\u53ef\u7a7a\u7c7b\u578b ? \u4e0e Option\u3002 \u672c\u6587\u662f\u7cfb\u5217\u7b2c 9 \u8bfe&#xff1a;\u7406\u89e3\u4ed3\u9889\u4e3a\u4ec0\u4e48\u6562\u8bf4&quot;\u4ece\u7c7b\u578b\u5c42\u9762\u6d88\u706d\u7a7a\u6307\u9488&quot;&#xff0c;\u638c\u63e1\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/106763.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-18T01:24:37+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/106763.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/106763.html\",\"name\":\"\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-18T01:24:37+00:00\",\"dateModified\":\"2026-09-18T01:24:37+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/106763.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/106763.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/106763.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/106763.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011\u53ef\u7a7a\u7c7b\u578b ? \u4e0e Option&#xff1a;\u8ba9\"\u6ca1\u6709\u503c\"\u65e0\u6cd5\u4f24\u4eba \u4e0a\u8282\u8bfe\u6211\u4eec\u5728 HashMap \u7684\u8f93\u51fa\u91cc\u53cd\u590d\u770b\u5230 Some(138-0000-0001)\u3001NoneValueException: Value does not exist!\u2014\u2014\u5f53\u65f6\u53ea\u7559\u4e86\u53e5\"\u7b2c 9 \u8bfe\u8bb2\"\u3002\u8fd9\u8282\u8bfe\u5c31\u6765\u6b63\u5f0f\u8ba4\u8bc6\u5b83\u4eec\u80cc\u540e\u7684\u8bbe\u8ba1&#xff1a;\u53ef\u7a7a\u7c7b\u578b ? \u4e0e Option\u3002 \u672c\u6587\u662f\u7cfb\u5217\u7b2c 9 \u8bfe&#xff1a;\u7406\u89e3\u4ed3\u9889\u4e3a\u4ec0\u4e48\u6562\u8bf4\"\u4ece\u7c7b\u578b\u5c42\u9762\u6d88\u706d\u7a7a\u6307\u9488\"&#xff0c;\u638c\u63e1","og_url":"https:\/\/www.wsisp.com\/helps\/106763.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-18T01:24:37+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/106763.html","url":"https:\/\/www.wsisp.com\/helps\/106763.html","name":"\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-18T01:24:37+00:00","dateModified":"2026-09-18T01:24:37+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/106763.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/106763.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/106763.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010\u4ed3\u9889\u8bed\u8a00\u5165\u95e8 \u00b7 \u7b2c9\u8bfe\u3011"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/106763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=106763"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/106763\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=106763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=106763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=106763"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=106763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}