{"id":1242,"date":"2026-09-10T05:09:48","date_gmt":"2026-09-10T05:09:48","guid":{"rendered":"https:\/\/x.sheep-mine.ts.net\/index.php\/52032919-kodebits-day-87-default-parameters\/"},"modified":"2026-09-10T05:09:48","modified_gmt":"2026-09-10T05:09:48","slug":"52032919-kodebits-day-87-default-parameters","status":"publish","type":"post","link":"https:\/\/x.sheep-mine.ts.net\/index.php\/52032919-kodebits-day-87-default-parameters\/","title":{"rendered":"Kodebits Day 87: Default Parameters"},"content":{"rendered":"<p><br \/>\n<\/p>\n<div>\n<h2 id=\"toc-anchor-001\">What is the output?<\/h2>\n<pre lang=\"kotlin\">\r\nfun greet(\r\n  name: String = \"Guest\"\r\n) = \"Hi, $name\"\r\nfun main() {\r\n  println(greet(\"Edith\"))\r\n  println(greet())\r\n}\r\n<\/pre>\n<p>\n  <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/play.kotlinlang.org\/embed?fromGist=2dbdddae78045a5aaeb7bb5acea92ccf\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>Try it in the online Kotlin Playground \u2192<br \/><\/a>\n<\/p>\n<p>[spoiler title=&#8221;Solution&#8221;]<\/p>\n<h3 id=\"toc-anchor-002\">Answer:<\/h3>\n<pre>\r\nHi, Edith\r\nHi, Guest\r\n<\/pre>\n<h3 id=\"toc-anchor-003\">Explanation:<\/h3>\n<p>Default parameters provide values when arguments aren\u2019t supplied.<\/p>\n<p>[\/spoiler]<\/p>\n<hr\/>\n<h3 id=\"toc-anchor-004\">Further Reading<\/h3>\n<\/p><\/div>\n<p><br \/>\n<br \/><a href=\"https:\/\/www.kodeco.com\/52032919-kodebits-day-87-default-parameters\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is the output? fun greet( name: String = &#8220;Guest&#8221; ) = &#8220;Hi, $name&#8221; fun&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1243,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1322,1321],"tags":[],"class_list":["post-1242","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-article","category-free"],"_links":{"self":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/posts\/1242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/comments?post=1242"}],"version-history":[{"count":0,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/posts\/1242\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/media\/1243"}],"wp:attachment":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/media?parent=1242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/categories?post=1242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/tags?post=1242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}