{"id":13370,"date":"2017-02-18T06:00:57","date_gmt":"2017-02-18T14:00:57","guid":{"rendered":"https:\/\/www.sapien.com\/blog\/?p=13370"},"modified":"2017-02-22T08:49:13","modified_gmt":"2017-02-22T16:49:13","slug":"friday-puzzle-solution-what-does-return-keyword-return","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2017\/02\/18\/friday-puzzle-solution-what-does-return-keyword-return\/","title":{"rendered":"Friday Puzzle Solution: What does Return keyword return?"},"content":{"rendered":"<p>On Friday, February 3, we posted a Friday Puzzle that shows a PowerShell function and a PowerShell class method that contain the same command sequence, including a statement with the <strong>Return<\/strong> keyword.<\/p>\n<p>The puzzle asks: What does the function return? What does the class method return? And, of course, we want to understand why.<\/p>\n<p>To solve this puzzle, I posted a video: <a href=\"https:\/\/www.youtube.com\/watch?v=aMiNhGlRkUg\">What does the PowerShell Return keyword return?<\/a> It&#8217;s a video explainer that examines the effect of using Return in a function and in classes, and it dives deep into the rules for using Return in a class method.<\/p>\n<p>For more information, see:<\/p>\n<ul>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/powershell\/reference\/5.1\/microsoft.powershell.core\/about\/about_return\">about_Return<\/a><\/li>\n<li><a href=\"http:\/\/info.sapien.com\/index.php\/scripting\/scripting-classes\/using-the-return-keyword-in-powershell-classes\">Using the Return keyword in PowerShell classes<\/a><\/li>\n<\/ul>\n<p><iframe loading=\"lazy\" title=\"What does the PowerShell Return keyword return?\" width=\"848\" height=\"636\" src=\"https:\/\/www.youtube.com\/embed\/aMiNhGlRkUg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p><em>June Blender is a technology evangelist at SAPIEN Technologies, Inc. and a Microsoft Cloud &amp; Datacenter MVP. You can reach her at <span id=\"cloakd1f0d8faebd589686ba1524671bc7547\"><span id=\"cloak793aa4afb0b2d963af5bb2fcd15e243c\"><span id=\"cloakb6e5a71dece42692baaa54ee63a08fd4\"><a href=\"mailto:juneb@sapien.com\">juneb@sapien.com<\/a><\/span><\/span><\/span> or follow her on Twitter at <a href=\"https:\/\/twitter.com\/juneb_get_help\" target=\"_blank\">@juneb_get_help<\/a>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>On Friday, February 3, we posted a Friday Puzzle that shows a PowerShell function and a PowerShell class method that contain the same command sequence, including a statement with the Return keyword. The puzzle asks: What does the function return? What does the class method return? And, of course, we want to understand why. To [&hellip;]<\/p>\n","protected":false},"author":31,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[932,1033,283,1143,941,943,1182,1055,25],"tags":[1187,282,934,28,1084,1192,1186,1191],"class_list":["post-13370","post","type-post","status-publish","format-standard","hentry","category-beginners","category-classes-in-powershell-5-0","category-howto","category-powershell","category-powershell-5-0","category-ps-version-5-0","category-puzzle","category-scripting","category-windows-powershell","tag-friday-puzzle","tag-functions","tag-juneb","tag-powershell","tag-powershell-classes","tag-powershell-functions","tag-puzzle","tag-return"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/13370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=13370"}],"version-history":[{"count":3,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/13370\/revisions"}],"predecessor-version":[{"id":13374,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/13370\/revisions\/13374"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=13370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=13370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=13370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}