Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 22, 2019 00:47
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 parzibyte/a0d27234ff9d7611235a237d5aaaf534 to your computer and use it in GitHub Desktop.
Save parzibyte/a0d27234ff9d7611235a237d5aaaf534 to your computer and use it in GitHub Desktop.
arreglo = ["Ruby", "Perl", "C", "Go", "Rust"]
# Si solamente se quiere comprobar si existe, usar include
busqueda = "C++"
if arreglo.include?(busqueda)
puts "El arreglo SÍ tiene el elemento #{busqueda}"
else
puts "El arreglo no incluye el elemento #{busqueda}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment