Today I was given a correct solution. I ran it beautifully in IRB and it interprets is perfectly. However if I paste that code in a ide and then I call the program from the console, it shows nothing, although it runs. If I add a puts to see something just before the boolean code it lists me true false etc but nothing like the IRB intepreter, which actually gives the words in one array that are contained in the phrases of the other array.
This is clearly saying I have a mind-bogging ignorance about how in heaven's name this works. It is as if the IDE did not interpret anything, so I went from Komodo and installed Rubymine and installed the ruby interpreter that the IDE would work with. No difference.
I have copied and pasted the code in the Tutorialspoint and got this permalink that shows live what happens. Can anyone tell me how I should do to get the IDE just do what the IRB does
the code is this anyway
words = ["house", "dog", "cat", "man", "girl"]
phrases = ["I have a house", "I am a dog", "I am man"]
words.select { |word| phrases.any? { |phrase| phrase.include? word } }
THIS IS WHAT IS SHOWN IN THE IRB IT IS FINE AND THAT IS WHAT I WANT
root@kali:~/rubyprograms# irb
irb(main):001:0> words = ["house", "dog", "cat", "man", "girl"]
=> ["house", "dog", "cat", "man", "girl"]
irb(main):002:0> phrases = ["I have a house", "I am a dog", "I am man"]
=> ["I have a house", "I am a dog", "I am man"]
irb(main):003:0>
irb(main):004:0* words.select { |word| phrases.any? { |phrase| phrase.include? word } }
=> ["house", "dog", "man"]
BUT IF YOU RUN THE SAME CODE (EXCEPT FOR A "PUTS" THAT I ADDED TO SEE SOMETHING" IT DOES NOT BRING AT ALL WHAT I WANT BUT A ROSTER OF BOOLEAN VALUES