This is a question from the app academy prep questions -- could someone explain the answer. I don't understand how the order of operations work in this while loop:

```
def dasherize_number(num)
  i = 0 
  dashed = ""
  num_s = num.to_s 

  while i < num_s.length
    digit = num_s[i].to_i
    if i > 0 
      prev_digit = num_s[i-1].to_i
      if prev_digit%2 == 1 || digit%2 == 1 
        dashed += "-" ## THIS LINE COMES FIRST

      end 
    end

    dashed += num_s[i] ## WHY IS THIS ADDED TO "DASHED" FIRST?

    i += 1
  end 
  return dashed
end

puts(dasherize_number(32467743))

```

the result is 3-245-7-7-4-3 so that all the odd numbers have a dash on either side except the end cases.

It doesn't make sense to me that the command to insert a dash is added to the new string after the original letter even though it comes first in the code.

Thanks!