Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module StringReverser
- def self.reverse(input)
- unless input.nil?
- reversed_string = []
- (input.length-1).downto(0) do |i|
- reversed_string << input[i]
- end
- reversed_string.join
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement