HELP ! Redacted in Ruby


Please help me !! I don't know what I did wrong, can someone explain to me, pls ?


In your each loop, "word" is just a text, word is a temporary variable that holds actual (in the loop context) element of your array.

Let's say that I have this array:

x = ["1", "2", "3"]

Now when I want to print out every element of this array I can use your code:

x.each do |word|
    print "word"

and it will result in:


because "word" is just a text.

After correcting the code:

x.each do |word|
    print word

we get the correct output:


After this correction:

print word

run your script and check how the output has changed.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.