Looping methods

Hello, I am new to using Ruby so I apologize if my question seems fairly
easy.

I am trying to loop a method back the the beginning of the method for
example:


def start
#code
end
gets.chomp

def other_start
puts “please type yes”

choice = gets.chomp!
end
end

start

#I want to loop the method “other_start” to the method “start” if the
user types “yes”


Now I know how to do loops but I don’t know how I would loop a method to
another method, would it be the same thing as just looping if the input
equals the answer I’m looking for? Such as:

other_start.each do |start|

If you could help me out with the syntax and explain what it’s doing,
that
would be greatly appreciated. Thank you ahead of time!

Sorry, I don’t understand your question. What do you mean by “looping a
method”??? You can’ “loop” a method.

Also, in your example code, you have defined a method other_start, but
you don’t invoke it anywhere, so from your example too, I have no idea
what you want to achieve.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs