Skip to content

Instantly share code, notes, and snippets.

@chiragmongia
Created March 17, 2013 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chiragmongia/5182611 to your computer and use it in GitHub Desktop.
Save chiragmongia/5182611 to your computer and use it in GitHub Desktop.
def palindrome
print "Enter the string\n"
line = gets.chomp
if line.reverse == line
p "String is a palindrome!"
else
p "String is not a palindrome!"
end
end
ch = 'a'
while ch !~ /\Aq|\AQ/
palindrome
print "Press any key to continue or q/Q to exit\n"
ch = gets.chomp
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment