{"id":286,"date":"2021-09-17T15:23:21","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"http:\/\/swift.tecc0.com\/?p=286"},"modified":"2021-09-17T15:23:21","modified_gmt":"1970-01-01T00:00:00","slug":"post-286","status":"publish","type":"post","link":"https:\/\/swift.tecc0.com\/?p=286","title":{"rendered":"Swift\u3067\u5f15\u6570\u3092\u53c2\u7167\u6e21\u3057(inout)\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p><strong>inout<\/strong> \u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u3044\u308f\u3086\u308b<strong>\u53c2\u7167\u6e21\u3057<\/strong>\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u5909\u6570\u3092\u52a0\u5de5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<p>\u500b\u4eba\u7684\u306b\u306f\u3042\u307e\u308a\u4f7f\u3044\u305f\u304f\u306a\u3044\u306e\u3067\u3001\u3086\u308b\u30fc\u304f\u8aac\u660e\u3057\u3068\u304f\u3002<\/p>\n<h3>Swift\u3067\u5f15\u6570\u3092\u53c2\u7167\u6e21\u3057\u3059\u308b<\/h3>\n<pre class=\"lang:swift decode:true \">func doubleNum (i1: inout Int, i2: inout Int) {\n    i1 = i1 * 2\n    i2 = i2 * 2\n}\n\nvar x = 2\nvar y = 3\n\nprint(x) \/\/ 2\nprint(y) \/\/ 3\n\ndoubleNum(i1: &amp;x, i2: &amp;y)\n\nprint(x) \/\/ 4\nprint(y) \/\/ 6<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u53c2\u7167\u6e21\u3057\u3092\u3057\u3066\u3044\u308b\u306e\u3067\u3001<span style=\"color: #ff0000;\">x\u3068y\u304c2\u500d\u3055\u308c\u3066\u3044\u308b<\/span>\u306e\u304c\u308f\u304b\u308b\u3002<\/p>\n<p>\u3082\u3046\u4e00\u5ea6\u8a00\u3046\u304c\u3001\u500b\u4eba\u7684\u306b\u4f7f\u3046\u3053\u3068\u306f\u3042\u307e\u308a\u306a\u3044\u3068\u601d\u3046\u306e\u3067<strong>\u5024\u6e21\u3057\u3068\u306e\u6bd4\u8f03<\/strong>\u3068\u304b\u306f\u3057\u306a\u3044\u3002<\/p>\n<p>\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3068\u304d\u306b\u5909\u6570\u306b <strong>&amp;<\/strong> \u3092\u3064\u3051\u308b\u3053\u3068\u306b\u6ce8\u610f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>inout \u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u3044\u308f\u3086\u308b\u53c2\u7167\u6e21\u3057\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u5909\u6570\u3092\u52a0\u5de5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002 \u500b\u4eba\u7684\u306b\u306f\u3042\u307e\u308a\u4f7f\u3044\u305f\u304f\u306a\u3044\u306e\u3067\u3001\u3086\u308b\u30fc\u304f\u8aac\u660e\u3057\u3068\u304f\u3002 Swift\u3067\u5f15\u6570\u3092\u53c2\u7167\u6e21\u3057\u3059\u308b func doubleNum (i1: i&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/286"}],"collection":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=286"}],"version-history":[{"count":4,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/286\/revisions"}],"predecessor-version":[{"id":840,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=\/wp\/v2\/posts\/286\/revisions\/840"}],"wp:attachment":[{"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swift.tecc0.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}