Skip to content

Instantly share code, notes, and snippets.

/palindrome.rb Secret

Created May 8, 2016 13:49
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 anonymous/036b2da0268a3649d22c4760a5dc6ad2 to your computer and use it in GitHub Desktop.
Save anonymous/036b2da0268a3649d22c4760a5dc6ad2 to your computer and use it in GitHub Desktop.
def palindrome?(string)
reverse = ""
i = 0
while string.length > reverse
reverse = string[i] + reverse
i += 1
end
if reverse == string
print true
if reverse != string
print false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment