title: Creating a script that will allow the user to input values repeatedly until each case has been entered
body: <p>I'm trying to create a script that will allow the user to input x-values repeatedly until each case has been entered. I have three possible cases: </p>
  
  <ul>
  <li>Case 1 is entered when <code>x &lt;= 7</code></li>
  <li>Case 2 is entered when <code>7 &lt;= x &lt;= 12</code>. </li>
  <li>Case 3 is entered when <code>x &gt; 12</code></li>
  </ul>
  
  <p>I want to use a <code>while</code> statement to error-check the user input, ensuring that <code>x &gt; 0</code>. Each time a case is entered, I want to print the case number &amp; the created y-value:</p>
  
  <ul>
  <li><code>y = x^3 + 3</code> for case 1</li>
  <li><code>y = (x-3)/2</code> for case 2</li>
  <li><code>y = 4*x+3</code> for case 3</li>
  </ul>
  
  <p>No case may be ran twice.  The script will output something like 'That case has been run already' should this happen. Once all cases have been entered, I want to print something like 'All cases have been entered'.</p>
  
  <p>Here is what I have tried so far:</p>
  
  <pre><code>  counter1 = 0;
    counter2 = 0;
    counter3 = 0;
    while counter1==0 || counter2==0 || counter3==0
    x = input('Please enter an x value &gt; 0: ');
    while x &lt; 0
        x = input('Invalid! Please enter another x value &gt; 0: ');
    end
    if counter1&gt;=1 || counter2&gt;=1 || counter3&gt;=1
        disp('That case has been run already');
    elseif x&lt;=7
        counter1 = counter1 + 1;
        y = x.^3 + 3;
        fprintf('Case 1: y = %d \n',y);
    elseif 7&lt;x &amp;&amp; x&lt;=12
        counter2 = counter2 + 1;
        y = (x-3)./2;
        fprintf('Case 2: y = %d \n',y);
    elseif x&gt;12
        counter3 = counter3 + 1;
        y = 4.*x+3; 
        fprintf('Case 3: y = %d \n',y);
    else counter1==1 &amp;&amp; counter2==1 &amp;&amp; counter3==1;
    end
    end
    disp('All cases have been entered!')
  </code></pre>
  
  <p>The only thing I can't seem to get to work now is this part:</p>
  
  <pre><code>  if counter1&gt;=1 || counter2&gt;=1 || counter3&gt;=1
        disp('That case has been run already');
  </code></pre>
  
  <p>It seems to be ignored entirely. Any suggestions?</p>