{"id":584,"date":"2024-12-22T20:49:30","date_gmt":"2024-12-22T11:49:30","guid":{"rendered":"https:\/\/immersed-in-knowing.com\/?p=584"},"modified":"2025-04-12T15:37:03","modified_gmt":"2025-04-12T06:37:03","slug":"kotlin_%e9%96%a2%e6%95%b0%e5%86%85%e3%81%a7%e8%87%aa%e5%88%86%e8%87%aa%e8%ba%ab%e3%82%92%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%99%ef%bc%88%e5%86%8d%e8%b5%b7%e7%9a%84%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9","status":"publish","type":"post","link":"https:\/\/immersed-in-knowing.com\/?p=584","title":{"rendered":"Kotlin_\u95a2\u6570\u5185\u3067\u81ea\u5206\u81ea\u8eab\u3092\u547c\u3073\u51fa\u3059\uff08\u518d\u8d77\u7684\u30d7\u30ed\u30b0\u30e9\u30e0\uff09"},"content":{"rendered":"\n<h2 class=\"wp-block-heading gutenify-section-962b8650-c056-11ef-b19c-134993443fbe\">\u518d\u5e30\u7684\u30d7\u30ed\u30b0\u30e9\u30e0<\/h2>\n\n\n\n<p class=\"gutenify-section-0758ada0-c055-11ef-b19c-134993443fbe\">\u518d\u5e30\u7684\u30d7\u30ed\u30b0\u30e9\u30e0\u3068\u306f\u3001\u3042\u308b\u95a2\u6570\u5185\u3067\u81ea\u5206\u81ea\u8eab\u306e\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\u30d7\u30ed\u30b0\u30e9\u30e0\u69cb\u9020\u3067\u3059\u3002<br>\u307b\u3068\u3093\u3069\u306e\u8a00\u8a9e\u3067\u5229\u7528\u53ef\u80fd\u3067\u3059\u304c\u3001\u518d\u5e30\u7684\u30d7\u30ed\u30b0\u30e9\u30e0\u306fCOBOL\u3084Fortran\u306a\u30691960\u5e74\u4ee3\u524d\u5f8c\u306b\u4f7f\u308f\u308c\u305f\u53e4\u3044\u8a00\u8a9e\u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002<br>\u5fdc\u7528\u60c5\u5831\u6280\u8853\u8005\u8a66\u9a13\u306a\u3069\u306e\u554f\u984c\u306a\u3069\u3067\u305f\u307e\u306b\u51fa\u3066\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"gutenify-section-97c1b6b0-c056-11ef-b19c-134993443fbe\"><br><\/p>\n\n\n\n<h2 class=\"wp-block-heading gutenify-section-9da74400-c056-11ef-b19c-134993443fbe\">\u968e\u4e57\u8a08\u7b97<\/h2>\n\n\n\n<p class=\"gutenify-section-ef8e2c80-c055-11ef-b19c-134993443fbe\">\u3068\u308a\u3042\u3048\u305a\u4f8b\u3068\u3057\u3066Kotlin\u3067\u968e\u4e57\u8a08\u7b97\uff08loopNumFunction\uff09\u3092\u6319\u3052\u307e\u3059\u3002<br>Jetpack Compose\u3067\u3059\u304c\u4ee5\u4e0b\u52d5\u4f5c\u78ba\u8a8d\u6e08\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color gutenify-section-324858d0-c055-11ef-b19c-134993443fbe wp-elements-41bb6a34babed87007c05eb7b872a4cd\"><code>fun loopNumFunction(\n    loopNum: Int\n): Int {\n    val returnNum: Int =\n        when (loopNum) {\n            0 -> 1\n            else -> loopNum * <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">loopNumFunction<\/mark>(loopNum = loopNum - 1)\n    }\n\n    Timber.tag(\"loopNumFunction\").d(\"loopNum: $loopNum, returnNum: $returnNum\")\n    return returnNum\n}<\/code><\/pre>\n\n\n\n<p class=\"gutenify-section-2c5a4000-c055-11ef-b19c-134993443fbe\">loopNumFunction\u5185\u3067loopNumFunction\u3092\u547c\u3073\u51fa\u3057\u3066\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color gutenify-section-21e3f510-c057-11ef-b19c-134993443fbe wp-elements-c1d44017bd79400abf1c0125b1326908\"><code>loopNumFunction(loopNum = 3)<\/code><\/pre>\n\n\n\n<p class=\"gutenify-section-7e4ab380-c056-11ef-b19c-134993443fbe\">\u3068\u3057\u305f\u3068\u304d\u306e\u7d50\u679c\u306f\u300c6\u300d\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"has-white-color has-black-background-color has-text-color has-background has-link-color gutenify-section-59c4c450-c057-11ef-b19c-134993443fbe wp-elements-2b70b27fbb9544ac8c503dcd37b0c1c4\">loopNumFunction \u00a0 \u00a0 loopNum: 0, returnNum: 1<br>loopNumFunction\u00a0\u00a0 \u00a0 loopNum: 1, returnNum: 1<br>loopNumFunction \u00a0 \u00a0 loopNum: 2, returnNum: 2<br>loopNumFunction \u00a0 \u00a0 loopNum: 3, returnNum: 6<\/p>\n\n\n\n<p class=\"gutenify-section-598faa90-c057-11ef-b19c-134993443fbe\">\u30ed\u30b0\u306f\u3053\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br>\u3061\u306a\u307f\u306b\u30013\u3092\u5165\u529b\u3057\u3066\u3044\u308b\u306e\u306b\u300cloopNum: 0\u300d\u304c\u5148\u306b\u30ed\u30b0\u3068\u3057\u3066\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u306e\u306f\u3001Timber.tag\u306e\u51e6\u7406\u304cloopNumFunction\u5185\u306eloopNumFunction\u304c\u5148\u306b\u8d70\u308b\u304b\u3089\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"gutenify-section-8abf7ba0-c056-11ef-b19c-134993443fbe\"><br><\/p>\n\n\n\n<h2 class=\"wp-block-heading gutenify-section-7ebec020-c058-11ef-b19c-134993443fbe\">\u30b9\u30bf\u30c3\u30af<\/h2>\n\n\n\n<p class=\"gutenify-section-8ae8ae80-c056-11ef-b19c-134993443fbe\">\u518d\u5e30\u7684\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u306b\u306f\u30b9\u30bf\u30c3\u30af\u304c\u5fc5\u8981\u3067\u3059\u3002<br>\u30b9\u30bf\u30c3\u30af\u3068\u306fLIFO\uff08\u5f8c\u5165\u308c\u5148\u51fa\u3057\uff09\u306e\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u3001\u5f8c\u3067\u633f\u5165\u3057\u305f\u8981\u7d20\u304c\u5148\u306b\u53d6\u308a\u51fa\u3055\u308c\u308b\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<br>\u4e3b\u30d7\u30ed\u30b0\u30e9\u30e0\uff08\u4e00\u756a\u6700\u521d\u306b\u547c\u3070\u308c\u305floopNumFunction\uff09\u304c\u95a2\u6570\uff08loopNumFunction\u5185\u3067\u547c\u3070\u308c\u305floopNumFunction\uff09\u3092\u547c\u3073\u51fa\u3059\u3068\u304d\u306b\u73fe\u5728\u5b9f\u884c\u3057\u3066\u3044\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u623b\u308a\u756a\u5730\u3092\u30b9\u30bf\u30c3\u30af\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"gutenify-section-1a84dc90-c056-11ef-b19c-134993443fbe\"><br><\/p>\n\n\n\n<h2 class=\"wp-block-heading gutenify-section-5da12940-c059-11ef-b19c-134993443fbe\">\u5229\u7528\u983b\u5ea6<\/h2>\n\n\n\n<p class=\"gutenify-section-81f4bdd0-c058-11ef-b19c-134993443fbe\">\u73fe\u5834\u3067\u306f\u3042\u307e\u308a\u518d\u5e30\u7684\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u306f\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br>\u7406\u7531\u3068\u3057\u3066\u306f\u53ef\u8aad\u6027\u304c\u60aa\u304f\u30d0\u30b0\u3092\u57cb\u3081\u8fbc\u307f\u3084\u3059\u3044\u3068\u3044\u3046\u306e\u304c\u4e00\u756a\u3067\u3001\u518d\u5e30\u7684\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5fc5\u8981\u3060\u3063\u305f\u3068\u3057\u3066\u3082filter\u95a2\u6570\u3084map\u95a2\u6570\u306a\u3069\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u95a2\u6570\u306e\u65b9\u304c\u4f7f\u3044\u52dd\u624b\u304c\u3088\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"gutenify-section-1a9b23b0-c056-11ef-b19c-134993443fbe\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u518d\u5e30\u7684\u30d7\u30ed\u30b0\u30e9\u30e0 \u518d\u5e30\u7684\u30d7\u30ed\u30b0\u30e9\u30e0\u3068\u306f\u3001\u3042\u308b\u95a2\u6570\u5185\u3067\u81ea\u5206\u81ea\u8eab\u306e\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\u30d7\u30ed\u30b0\u30e9\u30e0\u69cb\u9020\u3067\u3059\u3002\u307b\u3068\u3093\u3069\u306e\u8a00\u8a9e\u3067\u5229\u7528\u53ef\u80fd\u3067\u3059\u304c\u3001\u518d\u5e30\u7684\u30d7\u30ed\u30b0\u30e9\u30e0\u306fCOBOL\u3084Fortran\u306a\u30691960\u5e74\u4ee3\u524d\u5f8c\u306b\u4f7f\u308f\u308c\u305f\u53e4\u3044\u8a00\u8a9e\u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002\u5fdc\u7528\u60c5\u5831\u6280\u8853\u8005\u8a66\u9a13\u306a\u3069\u306e\u554f\u984c\u306a\u3069\u3067\u305f\u307e\u306b\u51fa\u3066\u304d\u307e\u3059\u3002 \u968e\u4e57\u8a08\u7b97 \u3068\u308a\u3042\u3048\u305a\u4f8b\u3068\u3057\u3066Kotlin\u3067\u968e\u4e57\u8a08\u7b97\uff08loopNumFunction\uff09\u3092\u6319\u3052\u307e\u3059\u3002Jetpack Compose\u3067\u3059\u304c\u4ee5\u4e0b\u52d5\u4f5c\u78ba\u8a8d\u6e08\u3067\u3059\u3002 loopNumFunction\u5185\u3067loopNumFunction\u3092\u547c\u3073\u51fa\u3057\u3066\u307e\u3059\u3002 \u3068\u3057\u305f\u3068\u304d\u306e\u7d50\u679c\u306f\u300c6\u300d\u3067\u3059\u3002 loopNumFunction \u00a0 \u00a0 loopNum: 0, returnNum: 1loopNumFunction\u00a0\u00a0 \u00a0 loopNum: 1, returnNum: 1loopNumFunction \u00a0 \u00a0 loopNum: 2, returnNum: 2loopNumFunction \u00a0 \u00a0 loopNum: 3, returnNum: 6 \u30ed\u30b0\u306f\u3053\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u3061\u306a\u307f\u306b\u30013\u3092\u5165\u529b\u3057\u3066\u3044\u308b\u306e\u306b\u300cloopNum: 0\u300d\u304c\u5148\u306b\u30ed\u30b0\u3068\u3057\u3066\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u306e\u306f\u3001Timber.tag\u306e\u51e6\u7406\u304cloopNumFunction\u5185\u306eloopNumFunction\u304c\u5148\u306b\u8d70\u308b\u304b\u3089\u3067\u3059\u3002 \u30b9\u30bf\u30c3\u30af \u518d\u5e30\u7684\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u306b\u306f\u30b9\u30bf\u30c3\u30af\u304c\u5fc5\u8981\u3067\u3059\u3002\u30b9\u30bf\u30c3\u30af\u3068\u306fLIFO\uff08\u5f8c\u5165\u308c\u5148\u51fa\u3057\uff09\u306e\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u3001\u5f8c\u3067\u633f\u5165\u3057\u305f\u8981\u7d20\u304c\u5148\u306b\u53d6\u308a\u51fa\u3055\u308c\u308b\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002\u4e3b\u30d7\u30ed\u30b0\u30e9\u30e0\uff08\u4e00\u756a\u6700\u521d\u306b\u547c\u3070\u308c\u305floopNumFunction\uff09\u304c\u95a2\u6570\uff08loopNumFunction\u5185\u3067\u547c\u3070\u308c\u305floopNumFunction\uff09\u3092\u547c\u3073\u51fa\u3059\u3068\u304d\u306b\u73fe\u5728\u5b9f\u884c\u3057\u3066\u3044\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u623b\u308a\u756a\u5730\u3092\u30b9\u30bf\u30c3\u30af\u3057\u3066\u3044\u307e\u3059\u3002 \u5229\u7528\u983b\u5ea6 \u73fe\u5834\u3067\u306f\u3042\u307e\u308a\u518d\u5e30\u7684\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u306f\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u7406\u7531\u3068\u3057\u3066\u306f\u53ef\u8aad\u6027\u304c\u60aa\u304f\u30d0\u30b0\u3092\u57cb\u3081\u8fbc\u307f\u3084\u3059\u3044\u3068\u3044\u3046\u306e\u304c\u4e00\u756a\u3067\u3001\u518d\u5e30\u7684\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5fc5\u8981\u3060\u3063\u305f\u3068\u3057\u3066\u3082filter\u95a2\u6570\u3084map\u95a2\u6570\u306a\u3069\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u95a2\u6570\u306e\u65b9\u304c\u4f7f\u3044\u52dd\u624b\u304c\u3088\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":628,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"gutenify_custom_css":"","gutenify_custom_css_data":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=\/wp\/v2\/posts\/584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=584"}],"version-history":[{"count":1,"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=\/wp\/v2\/posts\/584\/revisions"}],"predecessor-version":[{"id":586,"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=\/wp\/v2\/posts\/584\/revisions\/586"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=\/wp\/v2\/media\/628"}],"wp:attachment":[{"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/immersed-in-knowing.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}