Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions 02_reverse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@

# read about the following methods - String#split, Array#join, <<

def reverse(word)
def reverse(word):
new_string = ''
for i in range(0,len(word)):
new_string+=string[-i-1]
return new_string
end


p reverse("a") == "a"
p reverse("abba") == "abba"
p reverse("coding is fun")=="nuf si gnidoc"
p reverse("coding is fun")=="nuf si gnidoc"