title: Errors in up & down functions - solidity code
body: <p>In below code got errors for up n down function, please check and advise.</p>
  <p>Regards
  Syed</p>
  <p>pragma solidity ^0.7.6;</p>
  <p>contract TugOfWar {</p>
  <pre><code>int public score = 0;
  int constant endAt = 1 ether;
  bool public gameOver = false;
  
  event ScoreChanged(uint amount, bool up);
  event GameEnded(bool up); // where 'up' indicates which side won.
  
  function up() external payable {
      
      require(msg.value &gt; 0);
      require(!gameOver);
  
      int value = int(msg.value);
      score += value;
      
  </code></pre>
  <p>checkIfGameOver();</p>
  <pre><code>    emit ScoreChanged(msg.value, true); // where the second argument indicates the direction
  }
  
  function down() external payable {
      require(msg.value &gt; 0);
      require(!gameOver);
  
      int value = int(msg.value);
      score -= value;
      
  </code></pre>
  <p>checkIfGameOver();</p>
  <pre><code>    emit ScoreChanged(msg.value, true);
  }
  
  function checkIfGameOver() internal {
      if(score &gt;= endAt || score &lt;= endAt * -1) {
          gameOver = true;
  
          //
          emit GameEnded(true); // where the argument indicates which side has won. 
      }
  }
  </code></pre>
  <p>}</p>