title: If statements not working?
body: <p>I am a noob at programming. I just wanted to ask what is wrong with the following code:</p>
  
  <pre><code>scanf("%i", &amp;battlechoice);
  
  printf("BCHOICE WAS:%i\n", battlechoice);
  
  if (battlechoice=4) //fleeing
  {
      fleechance=rand() % 100;
      if (fleechance &lt;= 49)
      {
          printf("You attempt to flee...\n");
          sleep(2000);
          printf("Oh dear! You failed to flee! Gamover!\n");
          printf("Thank you for playing! -Anthony\n");
          sleep(7000);
          exit(0);
      } 
      else
      {
          printf("You succeeded in fleeing! You will be returned to town\nshortly...\n\n\n\n\n");
          sleep(3000);
          break;
      }
  }        //end fleeing
  
  else if (battlechoice=1) //attacking
  {
      //player damage gen
      printf("You commence the attack...\n");
      sleep(750);
      damagemax = rand() % lvl * 1.4;
  
      damageoutcome = damagemax + damagemin;
  }
  </code></pre>
  
  <p>What is happening is that it is doing both of the if statements, even though they both have different conditions? What is wrong? Thanks in advance.</p>