{"id":255979,"date":"2024-05-31T07:29:53","date_gmt":"2024-05-31T07:29:53","guid":{"rendered":"https:\/\/namso-gen.co\/blog\/?p=255979"},"modified":"2024-05-31T07:29:53","modified_gmt":"2024-05-31T07:29:53","slug":"how-to-assign-value-to-enum-values-outside-enum-declaration","status":"publish","type":"post","link":"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/","title":{"rendered":"How to assign value to enum values outside enum declaration?"},"content":{"rendered":"<p>Assigning values to enum values outside enum declaration can be achieved by using a technique called &#8220;enum extension.&#8221; This allows us to assign custom values to each enum value, providing more flexibility in representing data.<\/p>\n<p>By default, enum values are automatically assigned sequential integer values starting from 0. However, in certain situations, it might be necessary to assign different or specific values to enum members. Here&#8217;s how you can assign custom values to enum values outside the enum declaration:<\/p>\n<pre><code>enum Colors {<br \/>\n    Red,<br \/>\n    Blue = 5,<br \/>\n    Green,<br \/>\n    Purple = 10,<br \/>\n    Yellow<br \/>\n}<\/code><\/pre>\n<p>In the example above, the enum <code>Colors<\/code> has five members: <code>Red<\/code>, <code>Blue<\/code>, <code>Green<\/code>, <code>Purple<\/code>, and <code>Yellow<\/code>. By explicitly assigning values to some of the members, we can control their assigned values, resulting in a non-sequential sequence.<\/p>\n<p>The value <code>Red<\/code> is assigned 0 by default since we didn&#8217;t explicitly assign it a value. However, we assigned 5 to <code>Blue<\/code>, which makes it have a value of 5. <code>Green<\/code> comes next with a value of 6 (since enum values increment by 1), and subsequently, <code>Purple<\/code> has a value of 10. Finally, <code>Yellow<\/code> gets assigned 11.<\/p>\n<p><b>It&#8217;s essential to note that once a custom value is assigned to an enum member, the subsequent members continue with sequential values from that point.<\/b><\/p>\n<p>Here&#8217;s an example demonstrating the usage of the <code>Colors<\/code> enum:<\/p>\n<pre><code>let color: Colors = Colors.Green;<br \/>\nconsole.log(color); \/\/ Output: 6<\/code><\/pre>\n<p>The above code snippet assigns the value <code>Green<\/code> to the variable <code>color<\/code> of type <code>Colors<\/code>. When we print the value of <code>color<\/code>, it displays 6, confirming that the assigned value of <code>Green<\/code> is indeed 6.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_62 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#Related_FAQs\" title=\"Related FAQs:\">Related FAQs:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#1_Can_you_assign_any_type_of_value_to_enum_members\" title=\"1. Can you assign any type of value to enum members?\">1. Can you assign any type of value to enum members?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#2_Is_it_mandatory_to_assign_values_to_all_enum_members_if_we_assign_to_one_of_them\" title=\"2. Is it mandatory to assign values to all enum members if we assign to one of them?\">2. Is it mandatory to assign values to all enum members if we assign to one of them?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#3_Can_we_assign_the_same_value_to_multiple_enum_members\" title=\"3. Can we assign the same value to multiple enum members?\">3. Can we assign the same value to multiple enum members?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#4_Can_we_assign_non-sequential_values_manually_to_enum_members\" title=\"4. Can we assign non-sequential values manually to enum members?\">4. Can we assign non-sequential values manually to enum members?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#5_Can_we_assign_values_to_enum_members_during_runtime\" title=\"5. Can we assign values to enum members during runtime?\">5. Can we assign values to enum members during runtime?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#6_Can_we_assign_decimal_or_floating-point_values_to_enum_members\" title=\"6. Can we assign decimal or floating-point values to enum members?\">6. Can we assign decimal or floating-point values to enum members?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#7_Can_we_assign_negative_values_to_enum_members\" title=\"7. Can we assign negative values to enum members?\">7. Can we assign negative values to enum members?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#8_Do_enum_members_have_to_begin_with_a_value_of_0\" title=\"8. Do enum members have to begin with a value of 0?\">8. Do enum members have to begin with a value of 0?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#9_Are_enum_values_limited_to_integers\" title=\"9. Are enum values limited to integers?\">9. Are enum values limited to integers?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#10_What_happens_if_we_dont_assign_a_value_to_any_enum_members\" title=\"10. What happens if we don&#8217;t assign a value to any enum members?\">10. What happens if we don&#8217;t assign a value to any enum members?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#11_Can_the_value_assignment_of_enum_members_be_skipped\" title=\"11. Can the value assignment of enum members be skipped?\">11. Can the value assignment of enum members be skipped?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#12_Can_we_use_enum_members_as_keys_in_objects\" title=\"12. Can we use enum members as keys in objects?\">12. Can we use enum members as keys in objects?<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Related_FAQs\"><\/span>Related FAQs:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h3><span class=\"ez-toc-section\" id=\"1_Can_you_assign_any_type_of_value_to_enum_members\"><\/span>1. Can you assign any type of value to enum members?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>No, enum members can only be assigned values of type number or string.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_Is_it_mandatory_to_assign_values_to_all_enum_members_if_we_assign_to_one_of_them\"><\/span>2. Is it mandatory to assign values to all enum members if we assign to one of them?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>No, it is not necessary to assign values to all enum members if you explicitly assign a value to at least one of them. The subsequent members will receive sequential values starting from that point.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"3_Can_we_assign_the_same_value_to_multiple_enum_members\"><\/span>3. Can we assign the same value to multiple enum members?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>No, each enum member must have a unique value. Assigning the same value to multiple members will result in a compilation error.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"4_Can_we_assign_non-sequential_values_manually_to_enum_members\"><\/span>4. Can we assign non-sequential values manually to enum members?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>Yes, by explicitly assigning values to enum members, you can achieve non-sequential sequences. However, it is generally advisable to stick to sequential or patterned values to maintain code readability.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"5_Can_we_assign_values_to_enum_members_during_runtime\"><\/span>5. Can we assign values to enum members during runtime?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>No, enum members&#8217; values must be assigned during compile-time. Values assigned to enum members cannot be modified once the program is running.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"6_Can_we_assign_decimal_or_floating-point_values_to_enum_members\"><\/span>6. Can we assign decimal or floating-point values to enum members?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>No, enum members can only have values of type number or string. Decimal or floating-point values are not allowed.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"7_Can_we_assign_negative_values_to_enum_members\"><\/span>7. Can we assign negative values to enum members?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>Yes, negative values can be assigned to enum members of type number, as long as they fall within the range of valid numbers.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"8_Do_enum_members_have_to_begin_with_a_value_of_0\"><\/span>8. Do enum members have to begin with a value of 0?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>No, enum members can have any assigned value. Starting from 0 is the default behavior, but it can be overridden for individual members.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"9_Are_enum_values_limited_to_integers\"><\/span>9. Are enum values limited to integers?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>No, enum members can also be assigned string values. For example, we could assign <code>\"Primary\"<\/code> to the <code>Colors.Red<\/code> enum member.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"10_What_happens_if_we_dont_assign_a_value_to_any_enum_members\"><\/span>10. What happens if we don&#8217;t assign a value to any enum members?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>If a value is not explicitly assigned to an enum member, it will be automatically assigned the next sequential value based on the preceding members.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"11_Can_the_value_assignment_of_enum_members_be_skipped\"><\/span>11. Can the value assignment of enum members be skipped?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>Yes, you can skip values while assigning custom values to enum members. For example, you can assign values of 0, 5, and 10 to three members and let the remaining members receive auto-assigned sequential values starting from 11.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"12_Can_we_use_enum_members_as_keys_in_objects\"><\/span>12. Can we use enum members as keys in objects?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>Yes, enum members can be used as keys in objects. This can be useful in scenarios where you want to associate specific values or behaviors with each enum member.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Assigning values to enum values outside enum declaration can be achieved by using a technique called &#8220;enum extension.&#8221; This allows us to assign custom values to each enum value, providing more flexibility in representing data. By default, enum values are automatically assigned sequential integer values starting from 0. However, in certain situations, it might be &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to assign value to enum values outside enum declaration?\" class=\"read-more button\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#more-255979\">Read more<span class=\"screen-reader-text\">How to assign value to enum values outside enum declaration?<\/span><\/a><\/p>\n","protected":false},"author":65,"featured_media":107420,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86279],"tags":[],"class_list":["post-255979","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn","no-featured-image-padding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to assign value to enum values outside enum declaration?<\/title>\n<meta name=\"description\" content=\"Assigning values to enum values outside enum declaration can be achieved by using a technique called &quot;enum extension.&quot; This allows us to assign custom\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to assign value to enum values outside enum declaration?\" \/>\n<meta property=\"og:description\" content=\"Assigning values to enum values outside enum declaration can be achieved by using a technique called &quot;enum extension.&quot; This allows us to assign custom\" \/>\n<meta property=\"og:url\" content=\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/\" \/>\n<meta property=\"og:site_name\" content=\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/synchronyfinancial\" \/>\n<meta property=\"article:published_time\" content=\"2024-05-31T07:29:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2024\/03\/faq.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Timothy Mathis\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@synchrony\" \/>\n<meta name=\"twitter:site\" content=\"@synchrony\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Timothy Mathis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/\"},\"author\":{\"name\":\"Timothy Mathis\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/ffa5be155490b2344e28f672fcc1e318\"},\"headline\":\"How to assign value to enum values outside enum declaration?\",\"datePublished\":\"2024-05-31T07:29:53+00:00\",\"dateModified\":\"2024-05-31T07:29:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/\"},\"wordCount\":637,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\"},\"articleSection\":[\"Learn\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/\",\"url\":\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/\",\"name\":\"How to assign value to enum values outside enum declaration?\",\"isPartOf\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#website\"},\"datePublished\":\"2024-05-31T07:29:53+00:00\",\"dateModified\":\"2024-05-31T07:29:53+00:00\",\"description\":\"Assigning values to enum values outside enum declaration can be achieved by using a technique called \\\"enum extension.\\\" This allows us to assign custom\",\"breadcrumb\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/namso-gen.co\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to assign value to enum values outside enum declaration?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#website\",\"url\":\"https:\/\/namso-gen.co\/blog\/\",\"name\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\",\"description\":\"In Namso gen blog you can get many tips regarding to Credit cards, VCC, Credit card security etc. You can generate credit cards by using Namso-gen.co\",\"publisher\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/namso-gen.co\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\",\"name\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\",\"url\":\"https:\/\/namso-gen.co\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png\",\"contentUrl\":\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png\",\"width\":500,\"height\":164,\"caption\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\"},\"image\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/synchronyfinancial\",\"https:\/\/twitter.com\/synchrony\",\"https:\/\/www.youtube.com\/synchronyfinancial\",\"https:\/\/www.instagram.com\/synchrony\",\"https:\/\/www.linkedin.com\/company\/synchrony-financial\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/ffa5be155490b2344e28f672fcc1e318\",\"name\":\"Timothy Mathis\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"Timothy Mathis\"},\"description\":\"Guest author Timothy Mathis has meticulously crafted and revised this article to the best of their knowledge and understanding. Readers are strongly advised to exercise caution, verify information independently, and rely on their own judgment when considering the information provided. Read more articles on Namso Gen here.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to assign value to enum values outside enum declaration?","description":"Assigning values to enum values outside enum declaration can be achieved by using a technique called \"enum extension.\" This allows us to assign custom","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/","og_locale":"en_US","og_type":"article","og_title":"How to assign value to enum values outside enum declaration?","og_description":"Assigning values to enum values outside enum declaration can be achieved by using a technique called \"enum extension.\" This allows us to assign custom","og_url":"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/","og_site_name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","article_publisher":"https:\/\/www.facebook.com\/synchronyfinancial","article_published_time":"2024-05-31T07:29:53+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2024\/03\/faq.png","type":"image\/png"}],"author":"Timothy Mathis","twitter_card":"summary_large_image","twitter_creator":"@synchrony","twitter_site":"@synchrony","twitter_misc":{"Written by":"Timothy Mathis","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#article","isPartOf":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/"},"author":{"name":"Timothy Mathis","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/ffa5be155490b2344e28f672fcc1e318"},"headline":"How to assign value to enum values outside enum declaration?","datePublished":"2024-05-31T07:29:53+00:00","dateModified":"2024-05-31T07:29:53+00:00","mainEntityOfPage":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/"},"wordCount":637,"commentCount":0,"publisher":{"@id":"https:\/\/namso-gen.co\/blog\/#organization"},"articleSection":["Learn"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/","url":"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/","name":"How to assign value to enum values outside enum declaration?","isPartOf":{"@id":"https:\/\/namso-gen.co\/blog\/#website"},"datePublished":"2024-05-31T07:29:53+00:00","dateModified":"2024-05-31T07:29:53+00:00","description":"Assigning values to enum values outside enum declaration can be achieved by using a technique called \"enum extension.\" This allows us to assign custom","breadcrumb":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/namso-gen.co\/blog\/how-to-assign-value-to-enum-values-outside-enum-declaration\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/namso-gen.co\/blog\/"},{"@type":"ListItem","position":2,"name":"How to assign value to enum values outside enum declaration?"}]},{"@type":"WebSite","@id":"https:\/\/namso-gen.co\/blog\/#website","url":"https:\/\/namso-gen.co\/blog\/","name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","description":"In Namso gen blog you can get many tips regarding to Credit cards, VCC, Credit card security etc. You can generate credit cards by using Namso-gen.co","publisher":{"@id":"https:\/\/namso-gen.co\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/namso-gen.co\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/namso-gen.co\/blog\/#organization","name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","url":"https:\/\/namso-gen.co\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png","contentUrl":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png","width":500,"height":164,"caption":"Namso Gen Blog - Free Credit Card Generator [100% Valid]"},"image":{"@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/synchronyfinancial","https:\/\/twitter.com\/synchrony","https:\/\/www.youtube.com\/synchronyfinancial","https:\/\/www.instagram.com\/synchrony","https:\/\/www.linkedin.com\/company\/synchrony-financial"]},{"@type":"Person","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/ffa5be155490b2344e28f672fcc1e318","name":"Timothy Mathis","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"Timothy Mathis"},"description":"Guest author Timothy Mathis has meticulously crafted and revised this article to the best of their knowledge and understanding. Readers are strongly advised to exercise caution, verify information independently, and rely on their own judgment when considering the information provided. Read more articles on Namso Gen here."}]}},"_links":{"self":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts\/255979","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/comments?post=255979"}],"version-history":[{"count":0,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts\/255979\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/media\/107420"}],"wp:attachment":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/media?parent=255979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/categories?post=255979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/tags?post=255979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}