Answers.Body: <p>The problem is that you are setting <code>career</code> <strong>inside of</strong> the <code>if</code> statement. Defining it there won't make it available for your <code>elseif</code> statement.</p>
  
  <p>I've trimmed down your code so you can see exactly what the problem is:</p>
  
  <pre><code>{% set entries = ... %}
  
  {% if entries|length &gt; 0 %}
  
      {% set career = ... %}
  
  {% elseif career %}
  
      ...
  
  {% endif %}
  </code></pre>
  
  <p>If you want <code>career</code> to be available to your <code>elseif</code> statement, you need to define it <strong>before</strong> your <code>if</code> statement.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-19T18:42:01.597Z
Answers.Text: I was considering that, but didn't performed it. Thank  you @Lindsey D
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-19T18:48:32.283Z
Answers.Text: You are welcome! I was reviewing the edit history for your question, and noticed that Brad added indentation to your code example. I'm not sure if your original code also lacks indentation... Seeing it fully indented helped me find exactly where the error was. :)
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-19T18:37:50.300Z
Answers.LastActivityDate: 2015-03-19T18:37:50.300Z
Answers.UserDisplayName: Lindsey D
Body: <p>I get "Variable <code>career</code> does not exist". I'll just go straight to the code example...</p>
  
  <pre><code>{# Set ECM and get the entries stored in variable "entries" #}
  {% set entries = craft.entries.getAllSections('and, not career').type('news').order('RAND()').limit(3) %}
  
  {# Conditional statement - if more entries than 0, we output them. If false, we set other conditional statement/s. #}
  {% if entries|length &gt; 0 %}
  
      {# Loop through entries #}
      {% for entry in entries %}      
          &lt;li&gt;
              {# My Stuff #}
          &lt;/li&gt;
      {% endfor %}
  
      {# Set ECM and get the entries stored in variable "career" #}
      {% set career = craft.entries.section('career').type('news') %}
  
  {% elseif career %}
  
      {# Loop through career #}
      {% for career in career %}      
          &lt;li&gt;
              {# My Stuff #}
          &lt;/li&gt;
      {% endfor %}
  
  {% endif %}
  </code></pre>
  
  <p>Is it because of the first variable <code>entries</code>?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-19T17:31:51.773Z
Comments.Text: I don't understand the question... what variable doesn't exist? What's not working as you'd expect?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-19T18:18:20.720Z
Comments.Text: I expect to load `{% elseif career %}` if, the first statement is `false`. But variable `career` doesn't exists.
Comments.UserDisplayName: Dominik Krulak
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-19T21:15:50.460Z
Comments.Text: @Brad Bell Thank you for clean up and indentation!
Comments.UserDisplayName: Dominik Krulak
Tags: <variable><error>
Title: Variable doesn't exist
ThreadText: # Variable doesn't exist
  
  (Asked by: username_0 on 2015-03-19)
  
  I get "Variable `career` does not exist". I'll just go straight to the code example...
  
  ```
  {# Set ECM and get the entries stored in variable "entries" #}
  {% set entries = craft.entries.getAllSections('and, not career').type('news').order('RAND()').limit(3) %}
  
  {# Conditional statement - if more entries than 0, we output them. If false, we set other conditional statement/s. #}
  {% if entries|length > 0 %}
  
      {# Loop through entries #}
      {% for entry in entries %}      
          <li>
              {# My Stuff #}
          </li>
      {% endfor %}
  
      {# Set ECM and get the entries stored in variable "career" #}
      {% set career = craft.entries.section('career').type('news') %}
  
  {% elseif career %}
  
      {# Loop through career #}
      {% for career in career %}      
          <li>
              {# My Stuff #}
          </li>
      {% endfor %}
  
  {% endif %}
  
  ```
  
  Is it because of the first variable `entries`?
  
  **Tags:** variable, error
  
  > **Comments:**
  > **username_1**: I don't understand the question... what variable doesn't exist? What's not working as you'd expect?  
  > **username_0**: I expect to load `{% elseif career %}` if, the first statement is `false`. But variable `career` doesn't exists.  
  > **username_0**: @username_1 Thank you for clean up and indentation!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-03-19. Score: 2 | Accepted answer
  
  The problem is that you are setting `career` **inside of** the `if` statement. Defining it there won't make it available for your `elseif` statement.
  
  I've trimmed down your code so you can see exactly what the problem is:
  
  ```
  {% set entries = ... %}
  
  {% if entries|length > 0 %}
  
      {% set career = ... %}
  
  {% elseif career %}
  
      ...
  
  {% endif %}
  
  ```
  
  If you want `career` to be available to your `elseif` statement, you need to define it **before** your `if` statement.
  
  > **Comments:**
  > **username_0**: I was considering that, but didn't performed it. Thank  you @username_2  
  > **username_2**: You are welcome! I was reviewing the edit history for your question, and noticed that username_1 added indentation to your code example. I'm not sure if your original code also lacks indentation... Seeing it fully indented helped me find exactly where the error was. :)  
  
  ---
  
  