IF, Elsif & else en Ruby


print "Entero, por favor: "
num_usuario = Integer(gets.chomp)

if num_usuario < 0
  puts "¡Escogiste un entero negativo!"
elsif num_usuario > 0
  puts "¡Escogiste un entero positivo!"
else
  puts "¡Escogiste cero!"
end

No hay comentarios:

Publicar un comentario