Array subtraction

Hi everyone, been scratching my head on this one for ages!

test1=[1,6,4,11,13]
test2=[13,6]
test3=test1-test2

I want test3 to remove the elements in test2 from test1, resulting in [1,4,11] but instead I am getting [4,1,4,11], any ideas?

Thanks in advance

That’s weird! Which RUBY_VERSION and RUBY_ENGINE are you using? And what is the RUBY_PLATFORM?

I was being an idiot. The method that formed the second array was puts-ing one of the lines rather than returning it resulting in it printing twice!

Ah I see :joy::joy::joy:

I was going to install your Ruby version and Ruby engine on GNU/Linux to reproduce the error… :laughing:

Glad that you figured it out yourself!