title: How to use enums in C++
body: <p>Suppose we have an <code>enum</code> like the following:</p>
  
  <pre><code>enum Days {Saturday, Sunday, Tuesday, Wednesday, Thursday, Friday};
  </code></pre>
  
  <p>I want to create an instance of this <code>enum</code> and initialize it with a proper value, so I do:</p>
  
  <pre><code>Days day = Days.Saturday;
  </code></pre>
  
  <p>Now I want to check my variable or instance with an existing <code>enum</code> value, so I do:</p>
  
  <pre><code>if (day == Days.Saturday)
  {
      std::cout &lt;&lt; "Ok its Saturday";
  }
  </code></pre>
  
  <p>Which gives me a compilation error:</p>
  
  <blockquote>
    <p>error: expected primary-expression before ‘.’ token</p>
  </blockquote>
  
  <p>So to be clear, what is the difference between saying:</p>
  
  <pre><code>if (day == Days.Saturday) // Causes compilation error
  </code></pre>
  
  <p>and</p>
  
  <pre><code>if (day == Saturday)
  </code></pre>
  
  <p>?</p>
  
  <p>What do these two actually refer to, in that one is OK and one causes a compilation error?</p>