title: If and if-else statement in Angular project
body: <p>How do I write a if and if-else statement in Angular project? It's only the &quot;else&quot; that is returning, even though the initial conditions are true.</p>
  <pre><code>export class HomeComponent implements OnInit {
    productWorth: number;
    unit: number;
    pricePerProduct:any = this.changepricePerProduct();
    result: number;
    
    constructor() {}
  
    ngOnInit() {}
  
    changepricePerProduct() {
      if (this.productWorth &gt;= 200 &amp;&amp; (this.productWorth) &lt;= 2000) {
        return 150;
      } else if (this.productWorth &gt;= 2001 &amp;&amp; (this.productWorth) &lt;= 5000) {
        return 450
      } else if (this.productWorth &gt;= 5001 &amp;&amp; (this.productWorth) &lt;= 10000) {
        return 900
      } else if (this.productWorth &gt;= 10001 &amp;&amp; (this.productWorth) &lt;= 20000) {
        return 1200
      } else if (this.productWorth &gt;= 20000) {
        return 1500
      } else {
        return 0
      }
    }
  
    multiply() {
      this.result = this.pricePerProduct * this.unit;
    }
  }
       
  </code></pre>