Created
January 22, 2019 00:46
-
-
Save parzibyte/15bfa4a80a226365e72ac96785d787c3 to your computer and use it in GitHub Desktop.
This file contains 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment