Reverse a string
-
reverse
-
The original string stays intact
text = "The black cat climbed the green tree"
rev = text.reverse
puts rev
puts text
puts rev.reverse
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
reverse
The original string stays intact
text = "The black cat climbed the green tree"
rev = text.reverse
puts rev
puts text
puts rev.reverse