Thanks,

I just needed to use map instead of each.

Roelof



Wayne Conrad schreef op 6-6-2014 16:25:
> Array#join will do the trick:
>
>     print pairs.map { |key, value| "#{key} = #{value}" }.join(', ')
>
> if you want a new-line at the end of that, then use `puts` instead of 
> `print`
>
> On 06/06/2014 07:12 AM, Roelof Wobben wrote:
>> Hello,
>>
>> I have this :
>>
>> def solution(pairs)
>>   pairs.each {|key, value| print "#{key} = #{value}" }
>> end
>>
>> when I do solution({a: 1, b: '2'})  I see a = 1 b = 2
>> when I change the pairs to this
>>
>> pairs.each {|key, value| print "#{key} = #{value}, " }
>>
>> I will see a = 1, b=2,
>>
>> is there a way I can take care that after the 2 no , is displayed.
>>
>> Roelof
>>
>
>