{"id":3917,"date":"2019-03-31T01:22:39","date_gmt":"2019-03-30T16:22:39","guid":{"rendered":"https:\/\/greentown.tokyo\/?p=3917"},"modified":"2019-03-31T01:33:55","modified_gmt":"2019-03-30T16:33:55","slug":"10minutes-go18","status":"publish","type":"post","link":"https:\/\/greentown.tokyo\/?p=3917","title":{"rendered":"10\u5206GO 18\u65e5\u76ee - \u69cb\u9020\u4f53\u3068\u304b\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u578b\u3068\u304b\uff08\u7591\u554f\u6b8b\u308a\u4e2d\uff09"},"content":{"rendered":"<p>\u30da\u30fc\u30b9\u304c\u843d\u3061\u3066\u3044\u307e\u3059\u304c\u3001\u4eca\u9031\u306fWomen Who GO \u3055\u3093\u4e3b\u50ac\u306eGO\u306e\u304a\u52c9\u5f37\u4f1a\u306b\u884c\u3063\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>GO\u30e1\u30e2<\/h2>\n<p>\u8b1b\u5e2b\u306f@tenntenn\u3055\u3093\u3002<\/p>\n<p>\u57fa\u672c\u306e\u57fa\u672c\u306a\u304a\u52c9\u5f37\u3067\u3057\u305f\u304c\u3001\u5909\u6570\u306b\u3057\u3066\u3082\u95a2\u6570\u306b\u3057\u3066\u3082\u3072\u3068\u3064\u3072\u3068\u3064\u6df1\u304f\u89e3\u8aac\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u3001\u77e5\u3063\u3066\u308b\u3053\u3068\u3060\u3051\u3069\u3055\u3089\u306b\u77e5\u8b58\u306e\u30d6\u30e9\u30c3\u30b7\u30e5\u30a2\u30c3\u30d7\u304c\u3067\u304d\u305f\u3068\u3044\u3046\u304b\u3001\u6539\u3081\u3066\u3044\u3044\u304a\u52c9\u5f37\u3055\u305b\u3066\u3082\u3089\u3063\u305f\u306e\u3067\u3057\u305f\u3002<\/p>\n<p>tenntenn\u3055\u3093\u3001\u308f\u304b\u3089\u306a\u3044\u4eba\u304c\u3044\u305f\u3089\u8b1b\u7fa9\u30b9\u30c8\u30c3\u30d7\u3057\u3066\u3061\u3083\u3093\u3068\u308f\u304b\u308b\u307e\u3067\u6559\u3048\u3066\u304f\u308c\u308b\u30fb\u30fb\u3053\u3053\u5f8c\u56de\u3057\u306b\u3061\u3083\u3063\u305f\u3089\u5f8c\u3067\u5927\u5909\u3060\u304b\u3089\u301c\u3068\u3002\u6559\u3048\u308b\u59ff\u52e2\u3082\u7d20\u6674\u3089\u3057\u3044\u3002\u30a2\u30a6\u30c8\u30d7\u30c3\u30c8\u3082\u306a\u3093\u3067\u3082\u3044\u3044\u304b\u3089\u3057\u306a\u3055\u3044\u3088\u3068\u30fb\u30fb\u3002<\/p>\n<h3>\u6587\u6cd5<\/h3>\n<p>\u307b\u3093\u3068\u306b\u30e1\u30e2\u3002\u2193\u66f8\u3044\u305f\u3053\u3068\u4ee5\u5916\u3082\u3044\u3063\u3071\u3044\u3084\u3063\u305f\u3093\u3060\u3051\u3069\u3001\u8cc7\u6599\u3082\u3042\u308b\u306e\u3067\u5370\u8c61\u306b\u6b8b\u3063\u3066\u308b\u306e\u3060\u3051\u66f8\u3044\u3066\u307e\u3059\u3002<\/p>\n<h6>switch<\/h6>\n<ul>\n<li>break\u6587\u306f\u4e0d\u8981\u3002\u81ea\u52d5\u3067break\u3057\u3066\u304f\u308c\u308b\u3002<\/li>\n<li>break\u305b\u305a\u306b\u6b21\u306b\u7d9a\u3051\u305f\u3044\u5834\u5408\u306f\u3001<span style=\"color: #ff99cc;\"><strong>fallthrough<\/strong><\/span>\u3092\u8a18\u8ff0\u3059\u308b<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h6>for<\/h6>\n<pre class=\"lang:go decode:true \">func main() {\r\n\tvar i int\r\n\tfor {\r\n\t\tswitch {\r\n\t\tcase i%2 == 1:\r\n\t\t\tbreak\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n}\r\n<\/pre>\n<p>\u3053\u308c\u3060\u3068\u3001for\u6587\u3092\u629c\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u3002switch\u629c\u3051\u308b\u3060\u3051\u3002<\/p>\n<p>\u30e9\u30d9\u30eb\u3092\u4f7f\u3046\u3002<\/p>\n<pre class=\"lang:go decode:true \">func main() {\r\n\tvar i int\r\nLOOP:\r\n\tfor {\r\n\t\tswitch {\r\n\t\tcase i%2 == 1:\r\n\t\t\tbreak LOOP\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n}\r\n<\/pre>\n<p>VB\u3068\u304b\u306e\u30e9\u30d9\u30eb\uff08GOTO\u6587\uff09\u3063\u3066\u98db\u3073\u305f\u3044\u5148\u306b\u30e9\u30d9\u30eb\u8cbc\u308b\u3051\u3069\u3001GO\u306e\u5834\u5408\u306f\u30e9\u30d9\u30eb\u3067\u30b9\u30b3\u30fc\u30d7\u6c7a\u3081\u3066\u3001break\u3067\u30e9\u30d9\u30eb\u306e\u7bc4\u56f2\u304b\u3089\u629c\u3051\u308b\u3089\u3057\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>\u5909\u6570<\/h3>\n<h6>\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7<\/h6>\n<ul>\n<li>\u30b9\u30b3\u30fc\u30d7\u304c\u5c0f\u3055\u3044\u3068\u4fdd\u5b88\u304c\u3057\u3084\u3059\u3044<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h6>\u30b3\u30f3\u30dd\u30b8\u30c3\u30c8\u578b<\/h6>\n<ul>\n<li>\u4f55\u304b\u3057\u3089\u306e\u30c7\u30fc\u30bf\u304c\u96c6\u307e\u3063\u305f\u578b<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h6>\u69cb\u9020\u4f53\u3068map\u306e\u9055\u3044<\/h6>\n<ul>\n<li>\u69cb\u9020\u4f53\u306f\u3042\u3089\u304b\u3058\u3081\u3001\u30de\u30c3\u30d7\u306b\u5bfe\u3059\u308b\u30ad\u30fc\u304c\u6c7a\u307e\u3063\u3066\u3044\u308b<\/li>\n<li>\u30de\u30c3\u30d7\u306f\u306a\u3093\u3067\u3082OK<\/li>\n<\/ul>\n<p>\u3061\u3087\u3063\u3068\u610f\u5473\u308f\u304b\u3089\u3093\uff1f\u30de\u30c3\u30d7\u306b\u5bfe\u3059\u308b\u30ad\u30fc\u3068\u306f\uff1f\uff1f\u6b21\u56de\u805e\u3044\u3066\u307f\u3088\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<h6>\u30bc\u30ed\u5024<\/h6>\n<ul>\n<li>\u69cb\u9020\u4f53\uff1a\u30d5\u30a3\u30fc\u30eb\u30c9\u304c\u5168\u3066\u30bc\u30ed\u5024<\/li>\n<li>\u914d\u5217\uff1a\u8981\u7d20\u304c\u5168\u3066\u30bc\u30ed<\/li>\n<li>\u30b9\u30e9\u30a4\u30b9\uff1anil<\/li>\n<li>\u30de\u30c3\u30d7\uff1anil<\/li>\n<\/ul>\n<p>\u69cb\u9020\u4f53\u306e\u4e2d\u306bmap\u5834\u5408\u306fnil\u306b\u306a\u308b\u306e\u304b\uff1f\uff1f\uff1f<\/p>\n<p>&nbsp;<\/p>\n<h6>\u69cb\u9020\u4f53\u306e\u5ba3\u8a00<\/h6>\n<p>var<span class=\"Apple-converted-space\">\u00a0<\/span>n struct{} \u2190<span style=\"font-size: 150%; color: #ff0000;\"><strong>\u3068\u3058\u30ab\u30c3\u30b3\u307e\u3067\u5168\u3066\u578b<\/strong><span style=\"font-size: 70%; color: #808080;\">\uff08\u305d\u3093\u306a\u3053\u3068\u8003\u3048\u305f\u3053\u3068\u3082\u306a\u304b\u3063\u305f\uff09<\/span><\/span><\/p>\n<pre class=\"theme:dark-terminal lang:go decode:true \">var p struct\u2190\u69cb\u9020\u4f53\u3067\u3059\u3088\u5ba3\u8a00 {\r\n\u00a0 \u00a0 \u30d5\u30a3\u30fc\u30eb\u30c9\u540d \u578b\r\n\u00a0 \u00a0 \u30d5\u30a3\u30fc\u30eb\u30c9\u540d \u578b\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h6>\u30ea\u30c6\u30e9\u30eb<\/h6>\n<p>\u8b58\u5225\u5b50\uff08\u540d\u524d\uff09\u304c\u4ed8\u4e0e\u3055\u308c\u3066\u3044\u306a\u3044\u3082\u306e<\/p>\n<p>&nbsp;<\/p>\n<h6>\u578b\u30ea\u30c6\u30e9\u30eb<\/h6>\n<ul>\n<li>\u578b\u306e\u5177\u4f53\u7684\u306a\u5b9a\u7fa9\u3092\u66f8\u304d\u4e0b\u3057\u305f\u578b\u306e\u8868\u73fe\u65b9\u6cd5<\/li>\n<li>\u30b3\u30f3\u30dd\u30b8\u30c3\u30c8\u578b\u306a\u3069\u3092\u8868\u73fe\u3059\u308b\u305f\u3081\u306b\u4f7f\u3046<\/li>\n<li>\u5909\u6570\u5b9a\u7fa9\u3084\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u578b\u306a\u3069\u3067\u4f7f\u7528\u3059\u308b<\/li>\n<\/ul>\n<h6><\/h6>\n<h6>\u69cb\u9020\u4f53<\/h6>\n<p>\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u578b\u306f\u7d44\u307f\u8fbc\u307f\u578b\u4ee5\u5916\uff08\u30b3\u30f3\u30dd\u30b8\u30c3\u30c8\u578b\u3067\u3082\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u578b\uff09\u3067\u3082OK\u3002<\/p>\n<pre class=\"lang:go decode:true\">var p struct { \u00a0\u2190struct\u304b\u3089\u3068\u3058\u30ab\u30c3\u30b3\u307e\u3067\u578b\u30ea\u30c6\u30e9\u30eb\r\n    name string\r\n    age int\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h6><\/h6>\n<h6>\u69cb\u9020\u4f53\u521d\u671f\u5316<\/h6>\n<pre class=\"lang:go decode:true \">p := struct {\r\n    name string\r\n    age int\r\n}{\r\n    name: \"Gopher\",\r\n    age: 10,\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h6>\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u578b<\/h6>\n<p><span style=\"font-size: 120%;\"><strong><span style=\"color: #ff99cc;\">\u8d85\u91cd\u8981\uff01<\/span><\/strong><\/span>\u3063\u3066\u3053\u3068\u3067\u304b\u306a\u308a\u6642\u9593\u3092\u5272\u3044\u3066\u4e01\u5be7\u306b\u6559\u308f\u308a\u307e\u3057\u305f\uff08\u5b09\u3057\u3044\uff09\u3002<\/p>\n<p>\u81ea\u5206\u3082C\u3084\u308a\u59cb\u3081\u306e\u3053\u3068\u3001<span style=\"color: #ff99cc;\"><strong>typedef\u304c\u5168\u304f\u7406\u89e3\u3067\u304d\u306a\u304f\u3066<\/strong><\/span>\u8e93\u3044\u305f\u899a\u3048\u304c\u3042\u308b\u3002\u305d\u3057\u3066\u5f8c\u3005\u8f9b\u3044\u3002<\/p>\n<pre class=\"lang:go decode:true \">\/\/ \u7d44\u307f\u8fbc\u307f\u578b\r\ntype MyInt int\r\n\r\n\/\/ \u4ed6\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u578b\r\ntype MyWriter io.Writer\r\n\r\n\/\/ \u578b\u30ea\u30c6\u30e9\u30eb\u3092\u57fa\u306b\u3059\u308b struct\u304b\u3089\u3068\u3058\u30ab\u30c3\u30b3\u307e\u3067\u578b\r\ntype Person struct {\r\n    Name string\r\n}<\/pre>\n<p>\u2193\u69cb\u9020\u4f53\u3092\u3088\u304f\u3053\u3046\u3084\u3063\u3066\u66f8\u3044\u305f\u3044\u308b\u3059\u308b<\/p>\n<pre class=\"lang:default decode:true\">p := Person { Name:\u201dhoge\u201d}\r\n-----\r\nvar p Person\r\n<\/pre>\n<p>\u3053\u306e\u30d1\u30bf\u30fc\u30f3\u3057\u304b\u77e5\u3089\u306a\u3044\u4eba\u306f\u3001struct\u304c\u51fa\u3066\u304d\u305f\u6642\u306b\u6df7\u4e71\u3059\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>\u95a2\u6570<\/h3>\n<p>tenntenn\u3055\u3093\u300c\u95a2\u6570\u3063\u3066\u306a\u3093\u3067\u3059\u304b\uff1f\u8aac\u660e\u3067\u304d\u307e\u3059\uff1f\u300d<\/p>\n<p>\u6025\u306b\u632f\u3089\u308c\u308b\u30fb\u30fb<\/p>\n<p>\u79c1\u300c\u4f55\u304b\u6295\u3052\u308b\u3068\u3001\u3044\u3044\u611f\u3058\u306b\u3057\u305f\u3082\u306e\u304c\u8fd4\u3063\u3066\u304f\u308b\u611f\u3058\u300d\uff08\u2190\u9177\u3044\uff09<\/p>\n<p>tenntenn\u3055\u3093\u300cx\u3092\u5165\u308c\u305f\u3089y\u304c\u51fa\u308b\u307f\u305f\u3044\u306a\u306e\u306f\u3001<span style=\"color: #ff99cc;\"><strong><span style=\"font-size: 130%;\">\u6570\u5b66\u7684\u95a2\u6570<\/span><\/strong><\/span>\u3067\u3059\u306d\u300d<\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u7684\u306a\u306e\u95a2\u6570\u3068\u306f<\/p>\n<ul>\n<li>\u51e6\u7406\u306e\u307e\u3068\u307e\u308a<\/li>\n<li>\u6975\u7aef\u306b\u8a00\u3048\u3070\u5165\u51fa\u529b\u306f\u306a\u304f\u3066\u3082\u3044\u3044<\/li>\n<\/ul>\n<p>\u306a\u308b\u307b\u3069\u3001\u305d\u3046\u3067\u3059\u306d\u3002\u5f15\u6570\u306a\u3057\u3068\u304b\u3001\u623b\u308a\u304c\u306a\u3044\u3082\u306e\u3082\u3042\u308b\u30fb\u30fb\u3002<\/p>\n<p>&nbsp;<\/p>\n<h6>\u7d44\u307f\u8fbc\u307f\u578b\u95a2\u6570<\/h6>\n<ul>\n<li>\u8a00\u8a9e\u306e\u6a5f\u80fd\u3068\u3057\u3066\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u308b\u95a2\u6570<\/li>\n<li>\u3042\u305f\u307e\u306b \u300c<span style=\"color: #ff99cc; font-size: 120%;\"><strong>\u30d1\u30c3\u30b1\u30fc\u30b8\u540d.<\/strong><\/span>\u300d \u304c\u4ed8\u304b\u306a\u3044\u3082\u306e\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h6>\u95a2\u6570\u306b\u623b\u308a\u5024\u3092\u4f7f\u3044\u305f\u304f\u306a\u3044\u5834\u5408\u306f\u30d6\u30e9\u30f3\u30af\u5909\u6570\u3092\u4f7f\u3046<\/h6>\n<p>\u306a\u3093\u3067\u304b\u3063\u3066\u3001\u4f7f\u308f\u306a\u3044\u306e\u306b\u5909\u6570\u66f8\u3044\u3066\u53d7\u3051\u53d6\u3063\u3061\u3083\u3046\u3068\u300c\u3053\u306e\u5909\u6570\u4f7f\u3063\u3066\u306a\u3044\u3093\u3060\u3051\u3069\u300d\u3063\u3066\u30b3\u30f3\u30d1\u30a4\u30e9\u306b\u6012\u3089\u308c\u308b\u304b\u3089\u3002<\/p>\n<p>\u30d1\u30cb\u30c3\u30af\u3067\u3069\u3046\u306e\u3053\u3046\u306e\u3068\u304b\u8a00\u3063\u3066\u305f\u304b\u306a\u30fb\u30fb\u30fb\uff08\u540d\u524d\u4ed8\u304d\u623b\u308a\u5024\u3067\u3044\u3063\u3066\u305f\u304b\u306a\u30fb\u30fb\u5fd8\u308c\u305f\uff09<\/p>\n<p>&nbsp;<\/p>\n<h6>\u540d\u524d\u4ed8\u304d\u623b\u308a\u5024<\/h6>\n<p>\u623b\u308a\u5024\u306e\u5909\u6570\u306b\u540d\u524d\u3092\u3064\u3051\u308b<\/p>\n<pre class=\"lang:go decode:true\">func swap(x, y int) (x2, y2 int) {\r\n\ty2, x2 = x, y\r\n\treturn\r\n}<\/pre>\n<p>\u306a\u3093\u3067\u3044\u3061\u3044\u3061\u540d\u524d\u3092\u3064\u3051\u308b\u306e\u304b\uff1f<\/p>\n<p>\u4f8b\u3048\u3070\u3001int\u304c\u4e8c\u3064\u4e26\u3093\u3067\u308b\u5834\u5408\u3001\u5909\u6570\u540d\u304c\u3042\u308b\u3068\u3001\u306a\u3093\u306e\u5024\u304b\u63a8\u6e2c\u3057\u3084\u3059\u3044\u3002\u7def\u5ea6\u7d4c\u5ea6\u306a\u306e\u304b\u3001\u65e5\u4ed8\u306a\u306e\u304b\u3068\u304b<\/p>\n<p><span style=\"font-size: 120%; color: #ff99cc;\"><strong>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u5f79\u5272\u3092\u517c\u306d\u63c3\u3048\u3066\u3044\u308b<\/strong><\/span><\/p>\n<p>\u306a\u308b\u307b\u3069\uff01<\/p>\n<p>&nbsp;<\/p>\n<h6>\u305d\u306e\u4ed6<\/h6>\n<p>Go\u3063\u3066<\/p>\n<p>m, n = n, m<\/p>\n<p>\u3063\u3066\u66f8\u3051\u308b\u3060\u3063\u3066\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30da\u30fc\u30b9\u304c\u843d\u3061\u3066\u3044\u307e\u3059\u304c\u3001\u4eca\u9031\u306fWomen Who GO \u3055\u3093\u4e3b\u50ac\u306eGO\u306e\u304a\u52c9\u5f37\u4f1a\u306b\u884c\u3063\u3066\u304d\u307e\u3057\u305f\u3002 &nbsp; GO\u30e1\u30e2 \u8b1b\u5e2b\u306f@tenntenn\u3055\u3093\u3002 \u57fa\u672c\u306e\u57fa\u672c\u306a\u304a\u52c9\u5f37\u3067\u3057\u305f\u304c\u3001\u5909\u6570\u306b\u3057\u3066\u3082\u95a2\u6570 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":3950,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[95],"tags":[],"class_list":["post-3917","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-golang"],"_links":{"self":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3917"}],"collection":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3917"}],"version-history":[{"count":25,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3917\/revisions"}],"predecessor-version":[{"id":3953,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3917\/revisions\/3953"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/media\/3950"}],"wp:attachment":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}