< Back to Snippets

Add Selected

Sums the selected item and all items higher (newer) on the stack


<subroutine ID="AddSelected">
  <ifX wasSelected="false">
    <!-- Remember that if the Y register is empty, neither whileY wasSelected="true" nor whileY wasSelected="false" will loop -->
    <whileY wasSelected="false">
      <MathAdd.Action/>
    </whileY>
    <ifY wasSelected="true">
      <MathAdd.Action/>
    </ifY>
  </ifX>
</subroutine>