Skip to content

Returning value in "times" iterator #9

Description

@ianalexh

https://github.com/alexch/learn_ruby/tree/master/03_simon_says

This is a clear user error, but I can't find a different method or think of a different way.

In the "repeat" method, I'm supposed to be able to take any text and repeat it X number of times. The "times" method seemed the best way, but "times" returns the integer, not the printed text. I can't get past this exercise right now!

def repeat(input, x=2)
x.times {print "#{input} "}
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions