title: Error: break statement not within loop or switch
body: <p>I wrote this part of code and a series of error are being shown. The above mentioned error being the first. What is wrong in the code?</p>
  
  <pre><code>void direction(char ch)
  {
  
  switch(ch)
  case 'w': if(dirn!=3){dirn=1;}
            break;
  
  case 'a': if(dirn!=2){dirn=4;}
            break;
  
  case 's': if(dirn!=1){dirn=3;}
            break;
  
  case 'd': if(dirn!=4){dirn=2;}
            break;
  </code></pre>