def commify( number, positions)
positions = 3 if positions == nil
puts number.to_s.reverse.gsub(/(\d\d\d)(?=\d)(?!\d*.)/,
‘\1,’).reverse
^ not very sure how it would be done but something similar to
("\d"*positions)
end