title: Executing lines of code only once when a condition changes in a loop
body: <p>In the following code :</p>
  
  <pre><code>boolean condition=false;
  
  do{
      condition=expression;
  
      if(condition)
      {
          // subprogram 2
      }
  
      // subprogram 1
  
  }while(condition1);
  </code></pre>
  
  <p>I want to execute subprogram 2 only once (when "condition" changes from false to true, it will remain true afterwards) while the do-while loop keeps advancing.</p>
  
  <p>Is there a way to do it ?</p>