Skip to content

Instantly share code, notes, and snippets.

@lfborjas
Created April 14, 2012 06:48
Show Gist options
  • Save lfborjas/2382515 to your computer and use it in GitHub Desktop.
Save lfborjas/2382515 to your computer and use it in GitHub Desktop.
#la solución
def es_palindromo?(str)
return str == str.reverse
end
#pruebas
pruebas = ["anita lava la tina", "fantasma escritor"]
pruebas.each do |prueba|
puts "#{prueba} es palíndromo" if es_palindromo?(prueba)
end
loop do
print "RPN> "
rpn_expr = gets.chomp
#alguna condición para salir? PORQUE ESTE LOOP ES INFINITO!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment