{"id":2568,"date":"2024-10-07T15:52:05","date_gmt":"2024-10-07T06:52:05","guid":{"rendered":"http:\/\/batmask.dothome.co.kr\/?p=2568"},"modified":"2024-10-07T15:52:05","modified_gmt":"2024-10-07T06:52:05","slug":"kotlin-%ec%97%90-%ec%9d%b5%ec%88%99%ed%95%b4%ec%a7%80%ea%b8%b0-%eb%82%af%ec%84%a0-%eb%ac%b8%eb%b2%95%eb%93%a4-%ec%a0%95%eb%a6%ac-3","status":"publish","type":"post","link":"http:\/\/batmask.net\/index.php\/2024\/10\/07\/2568\/","title":{"rendered":"Kotlin \uc5d0 \uc775\uc219\ud574\uc9c0\uae30 : \ub0af\uc120 \ubb38\ubc95\ub4e4 \uc815\ub9ac #3"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\ub78c\ub2e4 \ud45c\ud604\uc2dd : <a href=\"https:\/\/kotlinlang.org\/docs\/lambdas.html\">https:\/\/kotlinlang.org\/docs\/lambdas.html<\/a><\/h3>\n\n\n\n<p>\ucf54\ud2c0\ub9b0\uc5d0\uc11c \ud568\uc218\ub294 first-class \uc774\ub2e4. \uc774 \uc758\ubbf8\ub294 \ud568\uc218\ub3c4 \uac1d\uccb4\ucc98\ub7fc \ubcc0\uc218\uc5d0 \uc800\uc7a5\ub3c4\ud558\uace0, \uc778\uc790\ub85c \ub118\uae30\uace0, \ub9ac\ud134\uac12\uc73c\ub85c \ub3cc\ub824\uc904 \uc218\ub3c4 \uc788\ub2e4\ub294 \uc598\uae30. \uc774\uc640\uac19\uc774 \ub2e4\ub8e8\uae30\uc704\ud574 \ud568\uc218 \ud0c0\uc785\uc758 \uc815\uc758\uac00 \ud544\uc694\ud55c\ub370 \ub2e4\uc74c\uacfc \uac19\uc774 \ud55c\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"(Int, String) -&gt; String \/\/ Int\uc640 String\ud0c0\uc785\uc758 \ub450 \uac1c\uc758 \uc778\uc790\ub97c \ubc1b\uace0 String\uc744 \ub9ac\ud134\ud558\ub294 \ud568\uc218\n() -&gt; Unit \/\/ \uc778\uc790\uac00 \uc5c6\uace0 \ub9ac\ud134\uac12\ub3c4 \uc5c6\ub294 \ud568\uc218\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ADBAC7\">(Int, String) <\/span><span style=\"color: #F47067\">-&gt;<\/span><span style=\"color: #ADBAC7\"> String <\/span><span style=\"color: #768390\">\/\/ Int\uc640 String\ud0c0\uc785\uc758 \ub450 \uac1c\uc758 \uc778\uc790\ub97c \ubc1b\uace0 String\uc744 \ub9ac\ud134\ud558\ub294 \ud568\uc218<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">() <\/span><span style=\"color: #F47067\">-&gt;<\/span><span style=\"color: #ADBAC7\"> Unit <\/span><span style=\"color: #768390\">\/\/ \uc778\uc790\uac00 \uc5c6\uace0 \ub9ac\ud134\uac12\ub3c4 \uc5c6\ub294 \ud568\uc218<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\ub78c\ub2e4 \ud45c\ud604\uc2dd(Lambda expression)\uc740 \ud45c\ud604\uc2dd\uc774\uba74\uc11c \ud558\ub098\uc758 \ud568\uc218\ub85c syntax\uc608\uc81c\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"val sum: (Int, Int) -&gt; Int = { x:Int, y: Int -&gt; x + y } \/\/ \uc624\ub978\ucabd \uad04\ud638 \ubd80\ubd84\uc774 lambda expression\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> sum: (<\/span><span style=\"color: #F69D50\">Int<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #F69D50\">Int<\/span><span style=\"color: #ADBAC7\">) -&gt; <\/span><span style=\"color: #F69D50\">Int<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> { x:<\/span><span style=\"color: #F69D50\">Int<\/span><span style=\"color: #ADBAC7\">, y: <\/span><span style=\"color: #F69D50\">Int<\/span><span style=\"color: #ADBAC7\"> -&gt; <\/span><span style=\"color: #F69D50\">x<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">+<\/span><span style=\"color: #ADBAC7\"> y } <\/span><span style=\"color: #768390\">\/\/ \uc624\ub978\ucabd \uad04\ud638 \ubd80\ubd84\uc774 lambda expression<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\ub78c\ub2e4 \ud45c\ud604\uc2dd\uc740 \ud568\uc218\uc640 \ub611\uac19\uc774 \uc911\uad04\ud638\ub85c \ubb36\uc778\ub2e4. \ud30c\ub77c\ubbf8\ud130\ub97c \ub098\uc5f4\ud558\ub294 \uac83\uc73c\ub85c \uc2dc\uc791\ud558\uc5ec \ud654\uc0b4\ud45c &#8216;-&gt;&#8217; \ub97c \uc4f0\uace0 \ud45c\ud604\uc2dd \ubc14\ub514\ubd80\ubd84\uc744 \uae30\uc220\ud55c\ub2e4. \ub9ac\ud134\uc774 \ub530\ub85c \ud45c\uc2dc\uac00 \uc5c6\uc9c0\ub9cc, \ud45c\ud604\uc2dd\uc778 \ub9cc\ud07c, \ub78c\ub2e4 \ud45c\ud604\uc2dd\uc740 \uc5ec\ub7ec\uc904\ub85c \uc0ac\uc6a9\ud560 \uc218\ub3c4 \uc788\uc73c\uba70, \ub9c8\uc9c0\ub9c9 \ud45c\ud604\uc2dd\uc758 \uac12\uc774 \ub9ac\ud134\uac12\uc774 \ub41c\ub2e4. \uc704 \uc608\uc5d0\uc120 x+y\uac12\uc774\ubbc0\ub85c \ub9ac\ud134\uac12\uc774 Int\uc774\ub2e4.<\/p>\n\n\n\n<p>\ud30c\ub77c\ubbf8\ud130\uac00 \uc5c6\ub2e4\uba74, \ud30c\ub77c\ubbf8\ud130\uc640 &#8216;-&gt;&#8217; \ub97c \uc4f0\uc9c0 \uc54a\uc544\ub3c4 \ub41c\ub2e4. \ud30c\ub77c\ubbf8\ud130\uac00 \ud558\ub098\uc778 \uacbd\uc6b0\uc5d0\ub3c4 \uc0dd\ub7b5 \uac00\ub2a5\ud558\uba70, \uc774 \ub54c\ub294 \ubc14\ub514\ubd80\ubd84\uc5d0\uc11c &#8220;it&#8221;\uc73c\ub85c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub2e4. \uc608\uc81c\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"ints.filter { it &gt; 0 } \/\/ (it: Int) -&gt; Boolean \ud0c0\uc785\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ADBAC7\">ints.<\/span><span style=\"color: #DCBDFB\">filter<\/span><span style=\"color: #ADBAC7\"> { it <\/span><span style=\"color: #F47067\">&gt;<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">0<\/span><span style=\"color: #ADBAC7\"> } <\/span><span style=\"color: #768390\">\/\/ (it: Int) -&gt; Boolean \ud0c0\uc785<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\ud30c\ub77c\ubbf8\ud130\uac00 \uc0ac\uc6a9\ub418\uc9c0 \uc54a\ub294 \uacbd\uc6b0, \uc5b8\ub354\uc2a4\ucf54\uc5b4 &#8216;_&#8217;\ub85c \uc790\ub9ac\ub97c \ucc44\uc6cc\ub193\uc744 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"map.forEach { (_, value) -&gt; println(&quot;$value!&quot;) }\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ADBAC7\">map.<\/span><span style=\"color: #DCBDFB\">forEach<\/span><span style=\"color: #ADBAC7\"> { (_, <\/span><span style=\"color: #F47067\">value<\/span><span style=\"color: #ADBAC7\">) <\/span><span style=\"color: #F47067\">-&gt;<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">println<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;<\/span><span style=\"color: #6CB6FF\">$value<\/span><span style=\"color: #96D0FF\">!&quot;<\/span><span style=\"color: #ADBAC7\">) }<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"57\" src=\"http:\/\/batmask.dothome.co.kr\/wordpress\/wp-content\/uploads\/2020\/04\/seperator.png\" alt=\"seperator\" class=\"wp-image-381\" srcset=\"http:\/\/batmask.net\/wordpress\/wp-content\/uploads\/2020\/04\/seperator.png 771w, http:\/\/batmask.net\/wordpress\/wp-content\/uploads\/2020\/04\/seperator-300x22.png 300w, http:\/\/batmask.net\/wordpress\/wp-content\/uploads\/2020\/04\/seperator-768x57.png 768w\" sizes=\"auto, (max-width: 771px) 100vw, 771px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\ub9c8\uc9c0\ub9c9 \uc778\uc790\uac00 \ud568\uc218\uc778 \uacbd\uc6b0, \uad04\ud638 \ubc16\uc5d0 \ub78c\ub2e4 \ud45c\ud604\uc2dd\uc73c\ub85c \uc0ac\uc6a9\ud558\uae30. : <a href=\"https:\/\/kotlinlang.org\/docs\/lambdas.html#passing-trailing-lambdas\">https:\/\/kotlinlang.org\/docs\/lambdas.html#passing-trailing-lambdas<\/a><\/h3>\n\n\n\n<p>\ucf54\ud2c0\ub9b0\uc5d0\uc11c \ud568\uc218\uc758 \ub9c8\uc9c0\ub9c9 \uc778\uc790\uac00 \ud568\uc218 \ud0c0\uc785\uc778 \uacbd\uc6b0, \uc778\uc790\uc758 \uad04\ud638 \ubc16\uc5d0 \ub9c8\uce58 \ud568\uc218 \ubc14\ub514\ucc98\ub7fc \ub78c\ub2e4 \ud45c\ud604\uc2dd \uc0ac\uc6a9\uc774 \uac00\ub2a5\ud558\ub2e4. \ub78c\ub2e4 \ud45c\ud604\uc2dd \ud615\ud0dc\uc758 \ud568\uc218\uac00 \ub0b4\uc6a9\uc774 \uae38\uc5b4\uc9c8 \uc218 \uc788\uc73c\ubbc0\ub85c \ub9e4\uc6b0 \uc720\ud6a8\ud55c \ud615\ud0dc\uc774\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"\/\/ fold \ud568\uc218 \uc120\uc5b8\uc744 \ubcf4\uba74 \ub2e4\uc74c\uacfc \uac19\ub2e4.\ninline fun &lt;T, R&gt; Array&lt;out T&gt;.fold(\n    initial: R,\n    operation: (acc: R, T) -&gt; R\n): R\n\n\/\/ fold \ud568\uc218\uc758 \uc0ac\uc6a9\nval product = items.fold(1) { acc, e -&gt; acc * e }\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #768390\">\/\/ fold \ud568\uc218 \uc120\uc5b8\uc744 \ubcf4\uba74 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">inline<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">fun<\/span><span style=\"color: #ADBAC7\"> &lt;<\/span><span style=\"color: #F69D50\">T<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #F69D50\">R<\/span><span style=\"color: #ADBAC7\">&gt; <\/span><span style=\"color: #DCBDFB\">Array<\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">out T<\/span><span style=\"color: #F47067\">&gt;<\/span><span style=\"color: #ADBAC7\">.<\/span><span style=\"color: #DCBDFB\">fold<\/span><span style=\"color: #ADBAC7\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    initial: <\/span><span style=\"color: #F69D50\">R<\/span><span style=\"color: #ADBAC7\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    operation: (<\/span><span style=\"color: #F69D50\">acc<\/span><span style=\"color: #ADBAC7\">: <\/span><span style=\"color: #F69D50\">R<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #F69D50\">T<\/span><span style=\"color: #ADBAC7\">) -&gt; <\/span><span style=\"color: #F69D50\">R<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">): <\/span><span style=\"color: #F69D50\">R<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ fold \ud568\uc218\uc758 \uc0ac\uc6a9<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> product <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> items.<\/span><span style=\"color: #DCBDFB\">fold<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #6CB6FF\">1<\/span><span style=\"color: #ADBAC7\">) { acc, e <\/span><span style=\"color: #F47067\">-&gt;<\/span><span style=\"color: #ADBAC7\"> acc <\/span><span style=\"color: #F47067\">*<\/span><span style=\"color: #ADBAC7\"> e }<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\uc704 \uc608\uc5d0\uc11c \ud655\uc7a5 \ud568\uc218 fold()\uc758 \ub450\ubc88\uc9f8 \uc778\uc790\uac00 \ud568\uc218 \ud0c0\uc785\uc774\uace0, \uc2e4\uc81c \uc0ac\uc6a9\uc5d0\uc120 \ub78c\ub2e4 \ud45c\ud604\uc2dd\uc73c\ub85c \ub118\uaca8\uc8fc\uace0 \uc788\ub2e4. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"57\" src=\"http:\/\/batmask.dothome.co.kr\/wordpress\/wp-content\/uploads\/2020\/04\/seperator.png\" alt=\"seperator\" class=\"wp-image-381\" srcset=\"http:\/\/batmask.net\/wordpress\/wp-content\/uploads\/2020\/04\/seperator.png 771w, http:\/\/batmask.net\/wordpress\/wp-content\/uploads\/2020\/04\/seperator-300x22.png 300w, http:\/\/batmask.net\/wordpress\/wp-content\/uploads\/2020\/04\/seperator-768x57.png 768w\" sizes=\"auto, (max-width: 771px) 100vw, 771px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">A.(B) -&gt; C : <a href=\"https:\/\/kotlinlang.org\/docs\/lambdas.html#function-literals-with-receiver\">https:\/\/kotlinlang.org\/docs\/lambdas.html#function-literals-with-receiver<\/a><\/h3>\n\n\n\n<p>\ubcf4\ub2e4\ubcf4\uba74 A.(B) -&gt; C \uc640 \uac19\uc740 \ud615\ud0dc\uc758 \ud45c\ud604\uc744 \ubcf4\uac8c \ub418\ub294\ub370, \ub9ac\uc2dc\ubc84 \uc624\ube0c\uc81d\ud2b8\ub97c \uac00\uc9c0\ub294 \ud568\uc218 \ud0c0\uc785\uc774\ub2e4. \ub9ac\uc2dc\ubc84 \uc624\ube0c\uc81d\ud2b8\uc5d0 \uc9c1\uc811 \uc811\uadfc\ud55c\ub2e4\ub294 \ubd80\ubd84\uc5d0\uc11c \ud655\uc7a5\ud568\uc218\uc640 \uc720\uc0ac\ud558\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"val sum: Int.(Int) -&gt; Int = { other -&gt; plus(other) }\n\n\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> sum: <\/span><span style=\"color: #F69D50\">Int<\/span><span style=\"color: #ADBAC7\">.(Int) <\/span><span style=\"color: #F47067\">-&gt;<\/span><span style=\"color: #ADBAC7\"> Int <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> { other <\/span><span style=\"color: #F47067\">-&gt;<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">plus<\/span><span style=\"color: #ADBAC7\">(other) }<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p> anonymous function\uc744 \uc774\uc6a9\ud558\uba74, \ub2e4\uc74c\uacfc \uac19\uc774 \uc0ac\uc6a9\ub3c4 \uac00\ub2a5\ud558\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"val sum = fun Int.(other: Int): Int = this + other\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> sum <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">fun<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">Int<\/span><span style=\"color: #ADBAC7\">.(other: <\/span><span style=\"color: #F69D50\">Int<\/span><span style=\"color: #ADBAC7\">): <\/span><span style=\"color: #F69D50\">Int<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">this<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">+<\/span><span style=\"color: #ADBAC7\"> other<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\ub78c\ub2e4 \ud45c\ud604\uc2dd\uc740 \ud568\uc218\uc640 \ub3d9\uc77c\ud558\ubbc0\ub85c, \uc704\uc758 \ud0c0\uc785\uc5d0 \ub300\uc785\ud558\uc5ec \uc0ac\uc6a9\uac00\ub2a5\ud558\ub2e4. \uc608\ub97c \ubcf4\uc790.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"class HTML {\n    fun body() { ... }\n}\n\nfun html(init: HTML.() -&gt; Unit): HTML {\n    val html = HTML()  \/\/ create the receiver object\n    html.init()        \/\/ pass the receiver object to the lambda\n    return html\n}\n\nhtml {       \/\/ lambda with receiver begins here\n    body()   \/\/ calling a method on the receiver object\n}\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">class<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F69D50\">HTML<\/span><span style=\"color: #ADBAC7\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">fun<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">body<\/span><span style=\"color: #ADBAC7\">() { <\/span><span style=\"color: #F47067\">..<\/span><span style=\"color: #ADBAC7\">. }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">fun<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">html<\/span><span style=\"color: #ADBAC7\">(init: <\/span><span style=\"color: #F69D50\">HTML<\/span><span style=\"color: #ADBAC7\">.() <\/span><span style=\"color: #F47067\">-&gt;<\/span><span style=\"color: #ADBAC7\"> Unit): <\/span><span style=\"color: #F69D50\">HTML<\/span><span style=\"color: #ADBAC7\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> html <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">HTML<\/span><span style=\"color: #ADBAC7\">()  <\/span><span style=\"color: #768390\">\/\/ create the receiver object<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    html.<\/span><span style=\"color: #DCBDFB\">init<\/span><span style=\"color: #ADBAC7\">()        <\/span><span style=\"color: #768390\">\/\/ pass the receiver object to the lambda<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> html<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">html<\/span><span style=\"color: #ADBAC7\"> {       <\/span><span style=\"color: #768390\">\/\/ lambda with receiver begins here<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #DCBDFB\">body<\/span><span style=\"color: #ADBAC7\">()   <\/span><span style=\"color: #768390\">\/\/ calling a method on the receiver object<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p> fun html\uc740 \uc778\uc790\ub85c \ub9ac\uc2dc\ubc84 \uc624\ube0c\uc81d\ud2b8 HTML\uc744 \uac16\ub294 \ud568\uc218 \ud0c0\uc785\uc744 \ubc1b\ub294\ub2e4. \ub9c8\uc9c0\ub9c9 \ubd80\ubd84\uc744 \ubcf4\uba74, body()\ub97c \uc2e4\ud589\ud558\ub294 \ub78c\ub2e4 \ud45c\ud604\uc2dd\uc744 \uc778\uc790\ub85c \ub118\uae30\uace0 \uc788\ub2e4. fun html() \ub0b4\ubd80\uc5d0\uc11c\ub294 \ub9ac\uc2dc\ubc84 \uc624\ube0c\uc81d\ud2b8\uc5d0 \uc774 \ub78c\ub2e4 \ud45c\ud604\uc2dd\uc744 \ubd99\uc5ec\uc11c \ub9ac\uc2dc\ubc84 \uc624\ube0c\uc81d\ud2b8\ub97c \uc804\ub2ec\ud558\uace0 \uc788\ub2e4. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"57\" src=\"http:\/\/batmask.dothome.co.kr\/wordpress\/wp-content\/uploads\/2020\/04\/seperator.png\" alt=\"seperator\" class=\"wp-image-381\" srcset=\"http:\/\/batmask.net\/wordpress\/wp-content\/uploads\/2020\/04\/seperator.png 771w, http:\/\/batmask.net\/wordpress\/wp-content\/uploads\/2020\/04\/seperator-300x22.png 300w, http:\/\/batmask.net\/wordpress\/wp-content\/uploads\/2020\/04\/seperator-768x57.png 768w\" sizes=\"auto, (max-width: 771px) 100vw, 771px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Null Safty : <a href=\"https:\/\/kotlinlang.org\/docs\/null-safety.html\">https:\/\/kotlinlang.org\/docs\/null-safety.html<\/a><\/h3>\n\n\n\n<p>\ucf54\ud2c0\ub9b0\uc740 null\uc5d0 \uc5c4\uaca9\ud55c \uc5b8\uc5b4\ub85c \ubcc0\uc218\uc5d0\uc11c null\uc774 \uac00\ub2a5\ud55c\uc9c0 \ubbf8\ub9ac \uc815\ud574\ub193\uace0 \uc2dc\uc791\ud55c\ub2e4. \ub610\ud55c, \uc774\ub7f0 null\uccb4\ud06c\ub97c \ub3c4\uc640\uc8fc\ub294 \uac83\ub4e4\uc774 \uc788\ub2e4. \uc774\ub7f0 \ubd80\ubd84\ub4e4\uc740 NPE( Null Pointer Exception)\uc744 \uc608\ubc29\ud558\ub294\ub370 \ud070 \ub3c4\uc6c0\uc774 \ub41c\ub2e4. <\/p>\n\n\n\n<p>\uc77c\ubc18\uc801\uc73c\ub85c \ubcc0\uc218\ub97c \uc120\uc5b8\ud558\uba74, \uc774 \ubcc0\uc218\ub4e4\uc740 Null\uc744 \uac16\uc744 \uc218 \uc5c6\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"\/\/ Assigns a non-null string to a variable\nvar a: String = &quot;abc&quot;\n\n\/\/ Returns the length of a non-nullable variable\nval l = a.length\nprint(l)  \/\/ 3\n\n\/\/ Attempts to re-assign null to the non-nullable variable\na = null\nprint(a)\n\/\/ Null can not be a value of a non-null type String\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #768390\">\/\/ Assigns a non-null string to a variable<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">var<\/span><span style=\"color: #ADBAC7\"> a: <\/span><span style=\"color: #F69D50\">String<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&quot;abc&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ Returns the length of a non-nullable variable<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> l <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> a.length<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">print<\/span><span style=\"color: #ADBAC7\">(l)  <\/span><span style=\"color: #768390\">\/\/ 3<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ Attempts to re-assign null to the non-nullable variable<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">a <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">null<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">print<\/span><span style=\"color: #ADBAC7\">(a)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ Null can not be a value of a non-null type String<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\uc704 \uc608\uc5d0\uc11c a  \ub294 null\uac12\uc744 \uc808\ub300 \uac16\uc9c0 \uc54a\uc73c\ubbc0\ub85c, a.length\ub97c \uc0ac\uc6a9\ud558\ub294\ub370 \uc544\ubb34\ub7f0 \uc704\ud5d8 \ubd80\ub2f4\uc774 \uc5c6\ub2e4. \ud558\uc9c0\ub9cc, \uc544\ub798\ucabd\uc5d0 null\uc744 \ub300\uc785\ud558\ub824 \ud55c\ub2e4\uba74 \uc5d0\ub7ec\uac00 \ub0a0 \uac83\uc774\ub2e4.<\/p>\n\n\n\n<p>null\uc774 \uac00\ub2a5\ud55c \ubcc0\uc218\ub294 &#8216;?&#8217;\ub97c \ub354\ud574\uc900\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"\/\/ Assigns a nullable string to a variable\nvar b: String? = &quot;abc&quot;\n\/\/ Successfully re-assigns null to the nullable variable\nb = null\nprint(b)\n\/\/ null\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #768390\">\/\/ Assigns a nullable string to a variable<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">var<\/span><span style=\"color: #ADBAC7\"> b: <\/span><span style=\"color: #F69D50\">String<\/span><span style=\"color: #ADBAC7\">? <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&quot;abc&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ Successfully re-assigns null to the nullable variable<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">b <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">null<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">print<\/span><span style=\"color: #ADBAC7\">(b)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ null<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\ubb38\uc81c\ub294 \uc774\uc81c b\uc758 \uba64\ubc84\ub97c \ucc38\uc870\ud558\uac70\ub098 \ud560 \ub54c, NPE\uc758 \uc704\ud5d8\uc774 \uc0dd\uae30\uac8c \ub41c\ub2e4. \ub2e4\ub978 \uc5b8\uc5b4\uc5d0\uc11c \uac00\uc7a5 \uc27d\uac8c \ubcfc \uc218 \uc788\ub294 \ubc29\ubc95\uc740 if\ubb38\uc744 \uc774\uc6a9\ud55c null \uccb4\ud06c\uc77c \uac83\uc774\ub2e4. \uc5ec\uae30\uc120 \ud328\uc2a4. \ucf54\ud2c0\ub9b0\uc740 \ub354 \ub2e4\uc591\ud55c \ud574\uacb0\ucc45\uc744 \uc900\ub2e4. \uba3c\uc800 safe call operator \uc778 &#8216;?.&#8217; \uc744 \uc81c\uacf5\ud55c\ub2e4. \uc774\ub294 \uba64\ubc84\ub97c \ucc38\uc870\ud558\uae30 \uc804\uc5d0 \uac1d\uccb4\uac00 null\uc774\uba74 \ucc38\uc870\ub97c \ud558\uc9c0\uc54a\uace0 \ubc14\ub85c null\uc744 \ub3cc\ub824\uc900\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"\/\/ Assigns a nullable string to a variable  \nval a: String? = &quot;Kotlin&quot;\n\/\/ Assigns null to a nullable variable\nval b: String? = null\n\n\/\/ Checks for nullability and returns length or null\nprintln(a?.length)\n\/\/ 6\nprintln(b?.length)\n\/\/ null\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #768390\">\/\/ Assigns a nullable string to a variable  <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> a: <\/span><span style=\"color: #F69D50\">String<\/span><span style=\"color: #ADBAC7\">? <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&quot;Kotlin&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ Assigns null to a nullable variable<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> b: <\/span><span style=\"color: #F69D50\">String<\/span><span style=\"color: #ADBAC7\">? <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">null<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ Checks for nullability and returns length or null<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">println<\/span><span style=\"color: #ADBAC7\">(a?.length)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ 6<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">println<\/span><span style=\"color: #ADBAC7\">(b?.length)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ null<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\ub2e4\uc74c\uc73c\ub85c Elvis operator &#8216;?:&#8217; \uac00 \uc788\ub2e4. safe operator\ub294 \uac1d\uccb4\uac00 null\uc774\uba74 null\uc744 \ub3cc\ub824\uc92c\uc9c0\ub9cc, \uc774\uac74 null\uc774 \uc544\ub2cc \ub2e4\ub978\uac12\uc744 \ub3cc\ub824\uc900\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"\/\/ Assigns null to a nullable variable  \nval b: String? = null\n\/\/ Checks for nullability. If not null, returns length. If null, returns a non-null value\nval l = b?.length ?: 0\nprintln(l)\n\/\/ 0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #768390\">\/\/ Assigns null to a nullable variable  <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> b: <\/span><span style=\"color: #F69D50\">String<\/span><span style=\"color: #ADBAC7\">? <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">null<\/span><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ Checks for nullability. If not null, returns length. If null, returns a non-null value<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> l <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> b?.length ?: <\/span><span style=\"color: #6CB6FF\">0<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">println<\/span><span style=\"color: #ADBAC7\">(l)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ 0<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\uc704\uc640 \uac19\uc774 \uc0ac\uc6a9\ud558\uba74, b?.length\uac00 null\uc774 \uc544\ub2c8\uba74 \uac12\uc744 \ub3cc\ub824\uc8fc\uace0 null\uc778 \uacbd\uc6b0 \uc624\ub978\ucabd\uc758 \uac12\uc778 0\ub97c \ub3cc\ub824\uc900\ub2e4.<\/p>\n\n\n\n<p>\uc138\ubc88\uc9f8\ub85c not-null assertion operator\uac00 \uc788\ub2e4. \uc774\ub294 null\uc774 \uac00\ub2a5\ud55c \ubcc0\uc218\uc5d0 \ub300\ud574 \uac1c\ubc1c\uc790\uac00 \ucef4\ud30c\uc77c\ub7ec\uc5d0\uac8c \uc5ec\uae30\uc11c\ub294 null\uc774 \ub420 \uc218 \uc5c6\uc74c\uc744 \uc54c\ub824\uc8fc\ub294 \uc5f0\uc0b0\uc790\uc774\ub2e4. \ub2e4\ub9cc, \uc798\ubabb\uc0ac\uc6a9\ud558\uba74 NPE \uc758 \uac00\ub2a5\uc131\uc774 \uc788\uc73c\ubbc0\ub85c \uc8fc\uc758\ud558\uc790.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"\/\/ Assigns a nullable string to a variable  \nval b: String? = &quot;Kotlin&quot;\n\/\/ Treats b as non-null and accesses its length\nval l = b!!.length\nprintln(l)\n\/\/ 6\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #768390\">\/\/ Assigns a nullable string to a variable  <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> b: <\/span><span style=\"color: #F69D50\">String<\/span><span style=\"color: #ADBAC7\">? <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&quot;Kotlin&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ Treats b as non-null and accesses its length<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">val<\/span><span style=\"color: #ADBAC7\"> l <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> b<\/span><span style=\"color: #F47067\">!!<\/span><span style=\"color: #ADBAC7\">.length<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">println<\/span><span style=\"color: #ADBAC7\">(l)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #768390\">\/\/ 6<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ub78c\ub2e4 \ud45c\ud604\uc2dd : https:\/\/kotlinlang.org\/docs\/lambdas.html \ucf54\ud2c0\ub9b0\uc5d0\uc11c \ud568\uc218\ub294 first-class \uc774\ub2e4. \uc774 \uc758\ubbf8\ub294 \ud568\uc218\ub3c4 \uac1d\uccb4\ucc98\ub7fc \ubcc0\uc218\uc5d0 \uc800\uc7a5\ub3c4\ud558\uace0, \uc778\uc790\ub85c \ub118\uae30\uace0, \ub9ac\ud134\uac12\uc73c\ub85c \ub3cc\ub824\uc904 \uc218\ub3c4 \uc788\ub2e4\ub294 \uc598\uae30. \uc774\uc640\uac19\uc774 \ub2e4\ub8e8\uae30\uc704\ud574 \ud568\uc218 \ud0c0\uc785\uc758 \uc815\uc758\uac00 \ud544\uc694\ud55c\ub370 \ub2e4\uc74c\uacfc \uac19\uc774 \ud55c\ub2e4. \ub78c\ub2e4 \ud45c\ud604\uc2dd(Lambda expression)\uc740 \ud45c\ud604\uc2dd\uc774\uba74\uc11c \ud558\ub098\uc758 \ud568\uc218\ub85c syntax\uc608\uc81c\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4. \ub78c\ub2e4 \ud45c\ud604\uc2dd\uc740 \ud568\uc218\uc640 \ub611\uac19\uc774 \uc911\uad04\ud638\ub85c \ubb36\uc778\ub2e4. \ud30c\ub77c\ubbf8\ud130\ub97c \ub098\uc5f4\ud558\ub294 \uac83\uc73c\ub85c \uc2dc\uc791\ud558\uc5ec \ud654\uc0b4\ud45c <a href=\"http:\/\/batmask.net\/index.php\/2024\/10\/07\/2568\/\" class=\"btn btn-link continue-link\">\ub354 \uc77d\uae30<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,34],"tags":[38,41],"class_list":["post-2568","post","type-post","status-publish","format-standard","hentry","category-etc","category-kotlin","tag-kotlin","tag-kotlin-kr"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts\/2568","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/comments?post=2568"}],"version-history":[{"count":31,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts\/2568\/revisions"}],"predecessor-version":[{"id":2618,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts\/2568\/revisions\/2618"}],"wp:attachment":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/media?parent=2568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/categories?post=2568"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/tags?post=2568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}