title: Recursion confusion
body: <p>I am writing a function according to the following guidelines:</p>
  
  <p>Given an array of ints, is it possible to choose a group of some of the ints, beginning at the start index, such that the group sums to the given target? However, with the additional constraint that all 6's must be chosen. (No loops needed.) </p>
  
  <pre><code>groupSum6(0, {5, 6, 2}, 8) → true
  groupSum6(0, {5, 6, 2}, 9) → false
  groupSum6(0, {5, 6, 2}, 7) → false
  </code></pre>
  
  <p>This is the solution:</p>
  
  <pre><code>public boolean groupSum6(int start, int[] nums, int target) {
      if (start == nums.length) {
          if (target == 0) {
              return true;
          }
          return false;
      }
      if (nums[start] == 6) {
          return groupSum6(start + 1, nums, target - nums[start]);
      }
      if (groupSum6(start + 1, nums, target - nums[start])) {
          return true;
      }
      return groupSum6(start + 1, nums, target);
  }
  </code></pre>
  
  <p>I am a little confused about why this works. I understand how it adds 6s, but where are the other numbers tested to see if they will add up to the target after the 6s have been added? Where are other non-6 numbers added?</p>