RosettaCodeData/Task/Palindrome-detection/Ruby/palindrome-detection-2.rb
2015-02-20 00:35:01 -05:00

9 lines
126 B
Ruby

def r_palindrome?(s)
if s.length <= 1
true
elsif s[0] != s[-1]
false
else
r_palindrome?(s[1..-2])
end
end