text: _N_E=(window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[20],{"20a2":function(e,a,t){e.exports=t("nOHt")},CZVI:function(e,a,t){"use strict";t.d(a,"a",(function(){return x}));var c=t("wx14"),n=t("Ff2n"),s=t("q1tI"),o=t.n(s),l=t("g4pe"),b=t.n(l),r=o.a.createElement;function p(e){var a=e.children;return r("h1",{className:"text-xl leading-9 font-bold text-gray-900 tracking-tight sm:text-2xl sm:leading-10 md:text-3xl md:leading-14"},a)}var i=t("SYun"),m=t.n(i),d=t("YFqc"),O=t.n(d),N=t("20a2"),j=t("7ljp"),u=o.a.createElement,h={pre:function(e){var a=e.className,t=Object(n.a)(e,["className"]);return u("pre",Object(c.a)({className:"".concat(a," rounded-md bg-gray-800 py-3 px-4 overflow-x-auto")},t))},"pre.code":function(e){var a=e.className,t=Object(n.a)(e,["className"]);return u("code",Object(c.a)({className:"".concat(a," text-gray-200")},t))}},g=m()("{dddd}, {MMMM} {DD}, {YYYY}");function x(e){var a=e.meta,t=e.children,c=e.posts,n=Object(N.useRouter)(),s=c.findIndex((function(e){return e.link===n.pathname})),o=c[s+1],l=c[s-1];return u("article",{className:"xl:divide-y xl:divide-gray-200"},u(b.a,null,u("title",null,a.title," \u2013 Tailwind CSS"),u("meta",{name:"twitter:card",content:"summary_large_image"}),u("meta",{name:"twitter:site",content:"@waynedahlberg"}),u("meta",{name:"twitter:creator",content:"@waynedahlberg"}),u("meta",{name:"twitter:title",content:"".concat(a.title," \u2013 Wayne Dahlberg")}),u("meta",{name:"twitter:description",content:a.description}),u("meta",{name:"twitter:image",content:"https://blog.tailwindcss.com".concat(a.image)}),u("meta",{property:"og:url",content:"https://blog.tailwindcss.com".concat(n.pathname)}),u("meta",{property:"og:type",content:"article"}),u("meta",{property:"og:title",content:"".concat(a.title," \u2013 Wayne Dahlberg")}),u("meta",{property:"og:description",content:a.description}),u("meta",{property:"og:image",content:"https://blog.tailwindcss.com".concat(a.image)}),u("meta",{name:"description",content:a.description})),u("header",{className:"pt-6 xl:pb-10"},u("div",{className:"space-y-1 text-center"},u("dl",{className:"space-y-10"},u("div",null,u("dt",{className:"sr-only"},"Published on"),u("dd",{className:"text-sm leading-6 font-medium text-gray-500"},u("time",{dateTime:a.date},g.render(new Date(a.date)))))),u("div",null,u(p,null,a.title)))),u("div",{className:"divide-y xl:divide-y-0 divide-gray-200 xl:grid xl:grid-cols-4 xl:col-gap-6 pb-16 xl:pb-20",style:{gridTemplateRows:"auto 1fr"}},u("dl",{className:"pt-6 pb-10 xl:pt-11 xl:border-b xl:border-gray-200"},u("dt",{className:"sr-only"},"Authors"),u("dd",null,u("ul",{className:"flex justify-center xl:block space-x-8 sm:space-x-12 xl:space-x-0 xl:space-y-8"},a.authors.map((function(e){return u("li",{key:e.twitter,className:"flex items-center space-x-2"},u("img",{src:e.avatar,alt:"",className:"w-10 h-10 rounded-full"}),u("dl",{className:"text-sm font-medium leading-5 whitespace-no-wrap"},u("dt",{className:"sr-only"},"Name"),u("dd",{className:"text-gray-900"},e.name),u("dt",{className:"sr-only"},"Twitter"),u("dd",null,u("a",{href:"https://twitter.com/".concat(e.twitter),className:"text-teal-500 hover:text-teal-700"},e.twitter))))}))))),u("div",{className:"divide-y divide-gray-200 xl:pb-0 xl:col-span-3 xl:row-span-2"},u("div",{className:"prose max-w-none pt-10 pb-8"},u(j.a,{components:h},t))),u("footer",{className:"text-sm font-medium leading-5 divide-y divide-gray-200 xl:col-start-1 xl:row-start-2"},(l||o)&&u("div",{className:"space-y-8 py-8"},l&&u("div",null,u("h2",{className:"text-xs tracking-wide uppercase text-gray-500"},"Next Article"),u("div",{className:"text-teal-500 hover:text-teal-600"},u(O.a,{href:l.link},u("a",null,l.title)))),o&&u("div",null,u("h2",{className:"text-xs tracking-wide uppercase text-gray-500"},"Previous Article"),u("div",{className:"text-teal-500 hover:text-teal-700"},u(O.a,{href:o.link},u("a",null,o.title))))),u("div",{className:"pt-8"},u(O.a,{href:"/"},u("a",{className:"text-teal-500 hover:text-teal-700"},"\u2190 All Posts"))))))}},dHPk:function(e,a,t){"use strict";a.a="/_next/static/media/waynedahlberg.ec5a7624841b4d34c6fd54883892118f.jpg"},hpkH:function(e,a,t){"use strict";a.a="/_next/static/media/hero-optionals.a6ecbae9854a85f4e410b03cf346dc0e.png"},iBhN:function(e,a,t){"use strict";t.d(a,"a",(function(){return c}));var c={name:"Wayne Dahlberg",twitter:"@waynedahlberg",avatar:t("dHPk").a}},kx4k:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/swift-optionals",function(){return t("t+tG")}])},"t+tG":function(e,a,t){"use strict";t.r(a),t.d(a,"__N_SSG",(function(){return i})),t.d(a,"meta",(function(){return m})),t.d(a,"default",(function(){return N}));var c=t("Ff2n"),n=t("wx14"),s=t("q1tI"),o=t.n(s),l=t("7ljp"),b=t("CZVI"),r=t("iBhN"),p=t("hpkH"),i=(o.a.createElement,!0),m={title:"Swift Optionals?",description:"Dealing with the absence of value",date:"2021-03-31T15:45:00.000Z",authors:[r.a],discussion:"https://github.com/tailwindlabs/tailwindcss/discussions/2511"},d={meta:m},O=function(e){return Object(l.b)(b.a,Object(n.a)({meta:m},e))};function N(e){var a=e.components,t=Object(c.a)(e,["components"]);return Object(l.b)(O,Object(n.a)({},d,t,{components:a,mdxType:"MDXLayout"}),Object(l.b)("img",{src:p.a,alt:"Swift Optionals Hero Image"}),Object(l.b)("p",null,'The Swift language is built on Type safety. One important Swift Type introduced with Swift 4 is the Optional Type. Optional types can represent a value or the non-existence of value. Basically an optional can say both, "There is a value, and it equals 4" as well as "There is no value here."'),Object(l.b)("p",null,"Optionals allow you to perform operations on variables that may or may not have a value currently assigned to them. Think about a simplified network call. You make a request for image data over a network. The images may take some time to load. In this oversimplified example, if you tried to access the image data before the the download was completed, your program would probably crash because the value of the images is nil, or 'there is no value', not even a zero value, nothing."),Object(l.b)("p",null,"Optionals are similar to nil pointers in C, except they work for any type, not simply classes."),Object(l.b)("h2",null,"Declaring Optionals"),Object(l.b)("p",null,"You can declare a variable as an optional by appending the variable name with a question mark, like so:\n",Object(l.b)("inlineCode",{parentName:"p"},"var myOptional: Int?")),Object(l.b)("p",null,"Here is another way of writing the above declaration:"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"var myOptional: Int? = nil")),Object(l.b)("p",null,"This initializes the variable with no value."),Object(l.b)("pre",{className:"language-swift"},Object(l.b)("code",Object(n.a)({parentName:"pre"},{className:"language-Swift"}),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"var")," myOptional",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),":")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"String"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"?")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"=")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"nil"),"\n\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"if")," myString ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"!=")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"nil")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"{"),"\n    ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-blue"}),"print"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"("),"myString",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),")"),"\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"}")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"else")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"{"),"\n    ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-blue"}),"print"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"("),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"myString has nil value"'),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),")"),"\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"}"),"\n")),Object(l.b)("p",null,"The above program would return the following:"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"myString has nil value")),Object(l.b)("p",null,"The value fails the nil check, and therefore prints the ",Object(l.b)("inlineCode",{parentName:"p"},"else")," case."),Object(l.b)("h2",null,"Unwrapping Optionals"),Object(l.b)("p",null,"If you imagine an optional as a gift box, it may be easier to understand. You shake the box and don't hear anything inside. That doesn't mean there isn't anything in there."),Object(l.b)("p",null,"We cannot access the contents of the gift box without opening it properly. In Swift, we have several proper ways to open these 'boxes.'"),Object(l.b)("h3",null,"Force Unwrapping"),Object(l.b)("p",null,"As mentioned above, a declared optional value must be properly unwrapped before we can use and evaluate its contents. If an optional value isn't properly unwrapped, you can't access the type and value inside. If there is a value inside and you try to access it, you'll get the value, but it will be of 'Optional` type."),Object(l.b)("blockquote",null,Object(l.b)("p",{parentName:"blockquote"},Object(l.b)("strong",{parentName:"p"},"Important")," - Try to use this method of unwrapping optionals as a last resort, or for simple testing and debugging purposes. You're basically telling the complier you know better than it does.")),Object(l.b)("p",null,"To directly access an optional's type and value contents, put an exclamation mark ",Object(l.b)("inlineCode",{parentName:"p"},"!")," at the end of the variable name."),Object(l.b)("pre",{className:"language-swift"},Object(l.b)("code",Object(n.a)({parentName:"pre"},{className:"language-Swift"}),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"var")," myString",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),":")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"String"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"?"),"\n\nmyString ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"=")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"Hello, Swift!!!"'),"\n\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"if")," myString ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"!=")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"nil")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"{"),"\n    ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-blue"}),"print"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"("),"myString",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),")"),"\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"}")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"else")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"{"),"\n    ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-blue"}),"print"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"("),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"myString has nil value"'),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),")"),"\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"}"),"\n\n")),Object(l.b)("p",null,"The above program produces:"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},'Optional("Hello, Swift!!!")')),Object(l.b)("p",null,"This is still of type 'Optional' and not of type ",Object(l.b)("inlineCode",{parentName:"p"},"String")," like we probably want."),Object(l.b)("p",null,"If we append ",Object(l.b)("inlineCode",{parentName:"p"},"myString")," with ",Object(l.b)("inlineCode",{parentName:"p"},"!")," when accessing the variable, it changes the entire result."),Object(l.b)("pre",{className:"language-swift"},Object(l.b)("code",Object(n.a)({parentName:"pre"},{className:"language-Swift"}),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"var")," myString",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),":")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"String"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"?"),"\n\nmyString ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"=")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"Hello, Swift!!!"'),"\n\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"if")," myString ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"!=")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"nil")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"{"),"\n    ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-blue"}),"print"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"("),"myString",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"!"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),")")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-gray-400 italic"}),"// <-- here"),"\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"}")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"else")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"{"),"\n    ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-blue"}),"print"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"("),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"myString has nil value"'),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),")"),"\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"}"),"\n\n")),Object(l.b)("p",null,"Now we get:"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Hello Swift!!!")),Object(l.b)("p",null,"This is now a valid String value, ready for further use."),Object(l.b)("h3",null,"Nil Coalescing"),Object(l.b)("p",null,"This is a neat way of dealing with optional values. It uses the double question mark ",Object(l.b)("inlineCode",{parentName:"p"},"??")," syntax. If your value is or ever becomes ",Object(l.b)("inlineCode",{parentName:"p"},"nil"),", then you're able to provide a backup value for that case."),Object(l.b)("pre",{className:"language-swift"},Object(l.b)("code",Object(n.a)({parentName:"pre"},{className:"language-Swift"}),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"let")," dogName ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"=")," dogs",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"["),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"name"'),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"]"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"."),"stringValue ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"?"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"?")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"Abbey"'),"\n")),Object(l.b)("p",null,"In the example above, if ",Object(l.b)("inlineCode",{parentName:"p"},"dogName")," is defined, it will be whatever the value of that assignment is. If the value ever becomes ",Object(l.b)("inlineCode",{parentName:"p"},"nil"),", then the value immediately becomes ",Object(l.b)("inlineCode",{parentName:"p"},"Abbey"),", a regular ",Object(l.b)("inlineCode",{parentName:"p"},"String")," value."),Object(l.b)("h3",null,"Optional Binding (",Object(l.b)("inlineCode",{parentName:"h3"},"if let"),")"),Object(l.b)("p",null,"A common pattern for unwrapping optionals is the ",Object(l.b)("inlineCode",{parentName:"p"},"if let")," pattern. If a non-optional value could be created from an optional value, it executes the code if the if block. If a non-optional value could not be created, it exits the scope."),Object(l.b)("pre",{className:"language-swift"},Object(l.b)("code",Object(n.a)({parentName:"pre"},{className:"language-Swift"}),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"if")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"let")," dogName ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"=")," dogs",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"["),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"name"'),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"]"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"."),"stringValue ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"{"),"\n    ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-blue"}),"print"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"("),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),"\"Unwrapped. Dog's name is ",Object(l.b)("span",Object(n.a)({parentName:"span"},{className:""}),Object(l.b)("span",Object(n.a)({parentName:"span"},{className:""}),"\\("),"dogName",Object(l.b)("span",Object(n.a)({parentName:"span"},{className:""}),")")),'."'),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),")"),"\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"}"),"\n")),Object(l.b)("h3",null,"Guard Let"),Object(l.b)("p",null,"The guard statement can transfer control out of the current scope, or escape from the scope before a certain condition. Similar to the ",Object(l.b)("inlineCode",{parentName:"p"},"if let")," syntax, but if a non-optional value cannot be produced, it doesn't exit, it escapes the current scope of the code. This requires and extra ",Object(l.b)("inlineCode",{parentName:"p"},"return")," statment scope, because there are no fallthrough cases in ",Object(l.b)("inlineCode",{parentName:"p"},"guard")," statements."),Object(l.b)("p",null,"Guard statements let you throw an error or return the value and type you're after. See the following:"),Object(l.b)("pre",{className:"language-swift"},Object(l.b)("code",Object(n.a)({parentName:"pre"},{className:"language-Swift"}),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"guard")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"let")," dogName ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"=")," dogs",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"["),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"name"'),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"]"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"."),"stringValue ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"else")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"{")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"return")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"}"),"\n")),Object(l.b)("p",null,"Here, if the dog's name cannot be accessed, or is ",Object(l.b)("inlineCode",{parentName:"p"},"== nil"),", we bounce from the function."),Object(l.b)("p",null,"One nice thing to add to your guard statements are assertions. These are great for debugging, and you can remind yourself when, why, and where things are crashing."),Object(l.b)("blockquote",null,Object(l.b)("p",{parentName:"blockquote"},Object(l.b)("strong",{parentName:"p"},"Note")," - Assertions do not cause a ",Object(l.b)("inlineCode",{parentName:"p"},"fatalError")," during production, only debugging, which is great.")),Object(l.b)("pre",{className:"language-swift"},Object(l.b)("code",Object(n.a)({parentName:"pre"},{className:"language-Swift"}),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"guard")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"let")," dogName ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:""}),"=")," dogs",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"["),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"name"'),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"]"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"."),"stringValue ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"else")," ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"{"),"\n    ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-blue"}),"assertionFaliure"),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"("),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-green"}),'"Couldn\'t unwrap Dog Name"'),Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),")"),"\n    ",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-purple"}),"return"),"\n",Object(l.b)("span",Object(n.a)({parentName:"code"},{className:"text-code-white"}),"}"),"\n")))}N.isMDXComponent=!0}},[["kx4k",0,2,1,3]]]);