Created
July 31, 2013 06:52
-
-
Save chiragmongia/6119889 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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