class Palin::Palindrom

Your code goes here…

Public Instance Methods

is_palindrome?(word) click to toggle source
# File lib/palin.rb, line 16
def is_palindrome?(word)
  word_arr = word.downcase.gsub(/ /,'').split('')
        if word_arr == reverse(word_arr)
                return "entered string is palindrome"
        else
                return "entered string is not a palindrome"
        end
  
end
reverse(word_arr) click to toggle source
# File lib/palin.rb, line 6
def reverse(word_arr)
        reverse = []
        index = word_arr.length
        until index == 0 do
                 reverse << word_arr[index - 1]
                index -= 1
         end
 reverse
end