Last active
August 29, 2015 14:22
-
-
Save panchiga/56ee98442dc747b26f67 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
arr = [1,2,3,4] | |
#配列の要素が2か3にマッチしたら配列中のそれを消去 | |
arr.each do |item| | |
if ((item == 2) || (item == 3)) | |
arr.delete(item) | |
end | |
end | |
#2と3を消去後の配列の出力 | |
arr.each do |item| | |
print item," " | |
end | |
puts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment