title: implementing retry in while loop
body: <p>I am trying to implement a retry in the while loop. I want to retry 5 times and if the flag becomes true.</p>
  
  <pre><code>bool flag = false;
  unsigned int count = 5;
  while(!flag &amp;&amp; count &gt; 0) {
      DataOperation opt = DataUser::Insert(data_point);
      if(opt == DataOperation::DataEnum) {
          UserPointData exist = DataUser::FindUser(data_point-&gt;user_id());
          if(exist) {
             exist-&gt;attributeData.put(key, value, len_value, client_id, last_modified_date);
              flag = true;
          }
      } else {
          // insert in data_point
          data_point-&gt;attributeData.put(key, value, len_value, client_id, last_modified_date);
          flag = true;
      }
      count--;
  }
  </code></pre>
  
  <ul>
  <li>So if flag becomes true, then I will exit out of the loop </li>
  <li>Second case, if flag is false for 5 times, then I will exit out of the loop as well.</li>
  </ul>
  
  <p>Does this look right what I am doing?</p>