{"id":3780,"date":"2022-12-30T14:24:11","date_gmt":"2022-12-30T06:24:11","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=3780"},"modified":"2022-12-30T14:24:11","modified_gmt":"2022-12-30T06:24:11","slug":"%e6%b7%b1%e5%85%a5%e6%8e%a2%e7%b4%a2go%e8%aa%9e%e8%a8%80%e4%b8%ad%e7%9a%84%e9%81%8b%e7%ae%97%e7%ac%a6","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/go\/%e6%b7%b1%e5%85%a5%e6%8e%a2%e7%b4%a2go%e8%aa%9e%e8%a8%80%e4%b8%ad%e7%9a%84%e9%81%8b%e7%ae%97%e7%ac%a6\/","title":{"rendered":"\u6df1\u5165\u63a2\u7d22Go\u8a9e\u8a00\u4e2d\u7684\u904b\u7b97\u7b26"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"Go, \u904b\u7b97\u7b26\"><\/p>\n<p>Go \u8a9e\u8a00\u7684\u904b\u7b97\u7b26\u662f\u4e00\u500b\u91cd\u8981\u7684\u6982\u5ff5\uff0c\u5b83\u53ef\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u66f4\u6709\u6548\u5730\u64b0\u5beb\u7a0b\u5f0f\u78bc\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u8a73\u7d30\u4ecb\u7d39 Go \u8a9e\u8a00\u4e2d\u7684\u904b\u7b97\u7b26\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u7bc4\u4f8b\u4f86\u8aaa\u660e\u5b83\u5011\u7684\u7528\u6cd5\u3002<\/p>\n<h2>Go \u8a9e\u8a00\u4e2d\u7684\u904b\u7b97\u7b26<\/h2>\n<p>Go \u8a9e\u8a00\u4e2d\u7684\u904b\u7b97\u7b26\u53ef\u4ee5\u5206\u70ba\u5169\u5927\u985e\uff1a\u7b97\u8853\u904b\u7b97\u7b26\u548c\u6bd4\u8f03\u904b\u7b97\u7b26\u3002\u7b97\u8853\u904b\u7b97\u7b26\u53ef\u4ee5\u7528\u4f86\u57f7\u884c\u7b97\u8853\u904b\u7b97\uff0c\u4f8b\u5982\u52a0\u6cd5\u3001\u6e1b\u6cd5\u3001\u4e58\u6cd5\u548c\u9664\u6cd5\uff1b\u800c\u6bd4\u8f03\u904b\u7b97\u7b26\u5247\u53ef\u4ee5\u7528\u4f86\u6bd4\u8f03\u5169\u500b\u503c\uff0c\u4f8b\u5982\u5927\u65bc\u3001\u5c0f\u65bc\u3001\u7b49\u65bc\u7b49\u3002<\/p>\n<h2>\u7b97\u8853\u904b\u7b97\u7b26<\/h2>\n<p>Go \u8a9e\u8a00\u4e2d\u7684\u7b97\u8853\u904b\u7b97\u7b26\u5305\u62ec\u52a0\u6cd5 (+)\u3001\u6e1b\u6cd5 (-)\u3001\u4e58\u6cd5 (*) \u548c\u9664\u6cd5 (\/)\u3002\u4e0b\u9762\u662f\u4e00\u500b\u7c21\u55ae\u7684\u7bc4\u4f8b\uff0c\u7528\u4f86\u8aaa\u660e\u5b83\u5011\u7684\u7528\u6cd5\uff1a<\/p>\n<pre class=\"brush: go\">\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n    a := 10\n    b := 5\n    fmt.Println(\"a + b =\", a + b)\n    fmt.Println(\"a - b =\", a - b)\n    fmt.Println(\"a * b =\", a * b)\n    fmt.Println(\"a \/ b =\", a \/ b)\n}\n<\/pre>\n<p>\u57f7\u884c\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\uff0c\u5c07\u6703\u5f97\u5230\u4ee5\u4e0b\u7684\u8f38\u51fa\u7d50\u679c\uff1a<\/p>\n<p><!--more--><\/p>\n<pre class=\"brush: go\">\na + b = 15\na - b = 5\na * b = 50\na \/ b = 2\n<\/pre>\n<h2>\u6bd4\u8f03\u904b\u7b97\u7b26<\/h2>\n<p>Go \u8a9e\u8a00\u4e2d\u7684\u6bd4\u8f03\u904b\u7b97\u7b26\u5305\u62ec\u5927\u65bc (>)\u3001\u5c0f\u65bc (&lt;)\u3001\u7b49\u65bc (<span class=\"text-highlighted-inline\" style=\"background-color: #fffd38;\">)\u3001\u4e0d\u7b49\u65bc (!=)\u3001\u5927\u65bc\u7b49\u65bc (>=) \u548c\u5c0f\u65bc\u7b49\u65bc (&lt;=)\u3002\u4e0b\u9762\u662f\u4e00\u500b\u7c21\u55ae\u7684\u7bc4\u4f8b\uff0c\u7528\u4f86\u8aaa\u660e\u5b83\u5011\u7684\u7528\u6cd5\uff1a<\/span><\/p>\n<pre class=\"brush: go\">\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n    a := 10\n    b := 5\n    fmt.Println(\"a > b =\", a > b)\n    fmt.Println(\"a < b =\", a < b)\n    fmt.Println(\"a == b =\", a == b)\n    fmt.Println(\"a != b =\", a != b)\n    fmt.Println(\"a >= b =\", a >= b)\n    fmt.Println(\"a <= b =\", a <= b)\n}\n<\/pre>\n<p>\u57f7\u884c\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\uff0c\u5c07\u6703\u5f97\u5230\u4ee5\u4e0b\u7684\u8f38\u51fa\u7d50\u679c\uff1a<\/p>\n<pre class=\"brush: go\">\na > b = true\na < b = false\na == b = false\na != b = true\na >= b = true\na <= b = false\n<\/pre>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u8a73\u7d30\u4ecb\u7d39\u4e86 Go \u8a9e\u8a00\u4e2d\u7684\u904b\u7b97\u7b26\uff0c\u4e26\u63d0\u4f9b\u4e86\u4e00\u4e9b\u7bc4\u4f8b\u4f86\u8aaa\u660e\u5b83\u5011\u7684\u7528\u6cd5\u3002Go \u8a9e\u8a00\u4e2d\u7684\u904b\u7b97\u7b26\u53ef\u4ee5\u5206\u70ba\u5169\u5927\u985e\uff1a\u7b97\u8853\u904b\u7b97\u7b26\u548c\u6bd4\u8f03\u904b\u7b97\u7b26\u3002\u7b97\u8853\u904b\u7b97\u7b26\u53ef\u4ee5\u7528\u4f86\u57f7\u884c\u7b97\u8853\u904b\u7b97\uff0c\u800c\u6bd4\u8f03\u904b\u7b97\u7b26\u5247\u53ef\u4ee5\u7528\u4f86\u6bd4\u8f03\u5169\u500b\u503c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0eGo\u8a9e\u8a00\u4e2d\u7684\u904b\u7b97\u7b26\uff0c\u5305\u62ec\u7b97\u8853\u904b\u7b97\u7b26\u3001\u6bd4\u8f03\u904b\u7b97\u7b26\u3001\u908f\u8f2f\u904b\u7b97\u7b26\u3001\u4f4d\u5143\u904b\u7b97\u7b26\u7b49\uff0c\u8b93\u8b80\u8005\u66f4\u52a0\u4e86\u89e3Go\u8a9e\u8a00\u4e2d\u7684\u904b\u7b97\u7b26\u529f\u80fd\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[171,172],"tags":[169,170],"class_list":["post-3780","post","type-post","status-publish","format-standard","hentry","category-go","category-golang","tag-go","tag-golang"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-YY","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=3780"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3780\/revisions"}],"predecessor-version":[{"id":3781,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3780\/revisions\/3781"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=3780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=3780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=3780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}