title: How to stop for loop if response from api is false?
body: <p>How do I stop for loop if response comes false from the api?. I have below code for api integration. Now currently api is calling as per loop at one time. I want to do call the same api if response from the api is true. Below is my code</p>
  
  <pre><code>            for (let i = 0; i &lt; this.fooditemselecteddetails.length; i++) {                   
                  this.spinnerService.hide();     
                  //console.log(this.fooditemselecteddetails);                          
                  this.common.createAPIService('api/booking/AddConcessions?CinemaId=' + this.cinemaid + '&amp;TransactionId=' + this.temptransaction.TransactionId + '&amp;ItemId=' + this.fooditemselecteddetails[i].id + '&amp;Quantity=' + this.fooditemselecteddetails[i].quantity + "&amp;BookingId=" + this.transactionAPIRequest.ORDER_ID, '').subscribe((result: any) =&gt; {
  
                      this.spinnerService.hide();
                      this.addconcession = result;
                      console.log(this.addconcession);
  
  
                      if (this.addconcession.IsSuccess == true) {
                          if (i == this.fooditemselecteddetails.length - 1) {
                              localStorage.setItem("bookingid", this.transactionAPIRequest.ORDER_ID);
                              this.common.createAPIService('api/booking/FinalBookingDetails?BookingId=' + this.transactionAPIRequest.ORDER_ID, '').subscribe((result2: any) =&gt; {
                                  this.vistavalidation = result2;
                                  if (this.vistavalidation.BookingID &gt; 0) {
                                      this.common.createAPIService('api/booking/ContinueTransaction?CinemaId=' + this.cinemaid + '&amp;TransactionId=' + this.temptransaction.TransactionId, '').subscribe((result3: any) =&gt; {
                                          if (result3.IsSuccess) {
                                              this.ContinueTransactionresult = result3;
                                              this.showTabOnClick('tabs-4');
                                          }
                                          else {                                           
                                              this.common.ShowNotification("Food Item", result3.Error, "info");
                                              this.spinnerService.hide();
                                          }
                                      });
                                  }
                                  else {
  
                                      this.common.ShowNotification("Food Item", 'something went wrong, please try again', "info");
                                      this.spinnerService.hide();
                                  }
                              });
                          }
                      }
                      else {
  
                          this.common.ShowNotification("Food Item", result.Error, "error");
                          this.spinnerService.hide();
                      }
                  });
              }
  </code></pre>
  
  <p>I want to call <code>AddConcessions?</code> this api again if response from this api is true. If it's returns false then stop loop there only.</p>