Skip to content

Instantly share code, notes, and snippets.

@chiragmongia
Created July 31, 2013 06:52
Show Gist options
  • Select an option

  • Save chiragmongia/6119889 to your computer and use it in GitHub Desktop.

Select an option

Save chiragmongia/6119889 to your computer and use it in GitHub Desktop.
def palindrome?(input_string)
input_string.reverse == input_string
end
#Main
wish_to_continue = 'a'
while wish_to_continue !~ /\Aq/i
p "Enter the string"
input_string = gets.chomp
if palindrome?(input_string)
p "String is a palindrome"
else
p "String is not a palindrome"
end
print "Press any key to continue or q/Q to exit\n"
wish_to_continue = gets.chomp
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment