Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- arreglo = ["Ruby", "Perl", "C", "Go", "Rust"]
- # index devuelve el índice (desde 0) o nil si no existe
- busqueda = "Perl"
- indice = arreglo.index(busqueda)
- if indice
- puts "El elemento #{busqueda} está en el índice #{indice}"
- else
- puts "No existe el elemento #{busqueda}"
- end
Add Comment
Please, Sign In to add comment