【概要】
1.結論
2.includeメソッドとは何か
3.どのようにプログラムしたか
1.結論
include?メソッドを使う!
2.include?メソッドとは何か ---------------------------------------- include?は配列の中に指定した要素が、あるかを判定するメソッドです!
3.どのようにプログラムしたか ----------------------------------------
def array_hello(strs)
if strs.include?(hello)
puts "True"
else
puts "False"
end
end
"strs"の引数から"hello"という文字を探したいので、
strs.include?(hello)という書き方にしています!
引数.include?(探したい配列内の文字)で適用できます!