I have a string in Ruby:

sentence = "My name is Robert"

How can I replace any one word in this sentence easily without using complex code or a loop?

4 Answers
4

Leave a Reply

Your email address will not be published. Required fields are marked *