Skip to content

Instantly share code, notes, and snippets.

@krokrob
Created January 7, 2016 10:34
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 krokrob/8817fbab1f3b8a0bb46c to your computer and use it in GitHub Desktop.
Save krokrob/8817fbab1f3b8a0bb46c to your computer and use it in GitHub Desktop.
# SELECT
# INPUT: array
# OUTPUT: array which size <= INPUT
array = ['Michel Polnareff', 'Michel Jonasz', 'Michel Delpech', 'Maxime Leforestier']
michels = []
array.each do |singer|
if singer.split.first == "Michel"
michels << singer
end
end
#p michels
array.select! do |singer|
singer.split.first == "Michel"
end
p array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment