Skip to content

Instantly share code, notes, and snippets.

@irinoyasu
Created February 20, 2016 03:42
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 irinoyasu/15df7fe643e78d6898a7 to your computer and use it in GitHub Desktop.
Save irinoyasu/15df7fe643e78d6898a7 to your computer and use it in GitHub Desktop.
# # 3の倍数の時だけをやってみる
# array = Array 1..100
# array.each do |i|
# if i%3 == 0
# puts "SAN"
# else
# puts i
# end
# end
# # 3のつく数字の時だけをやってみる
# array = Array 1..100
# array.each do |i|
# if i.to_s.include?("3")
# puts "SAN"
# else
# puts i
# end
# end
# 3の倍数の時 or 3のつく数字の時を合わせる
array = Array 1..100
array.each do |i|
if i%3 == 0 || i.to_s.include?("3")
puts "SAN"
else
puts i
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment