Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 713 Bytes

reverse.markdown

File metadata and controls

32 lines (22 loc) · 713 Bytes

Reverse

Base

Ruby has a built in string method #reverse. It does what you would expect and reverses the text inside of a given string.

pry(main)> a = "skittles"
pry(main)> a.reverse
=> "selttiks"

Write a method that will implement this same functionality so that the following code snippet will run.

StringReverser.reverse("skittles")
=> "selttiks"

Do not use #reverse in the method you create.

Extension 1

Ruby also has a #length method that returns the length of a string.

pry(main)> a = "skittles"
pry(main)> a.length
=> 8

Extend your existing StringReverser class to implement a #length method that does not use #length in its implementation.