Created
January 7, 2016 10:34
-
-
Save krokrob/8817fbab1f3b8a0bb46c 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
# 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