Ruby学習シリーズ----疑問(1)

907 ワード

詳細
def sayGoodnight(name)
	#result = "Goodnight #{name}"
	result = "Goodnight, " + name
	return result
end

puts (sayGoodnight ("john-bo"))

Goodnight, john-bo
実行成功
puts sayGoodnight ("john-bo")

Goodnight, john-bo
warning: don't put space before argument parentheses
puts sayGoodnight "john-bo"

Goodnight, john-bo
warning: parenthesize argument(s) for future version
ルビーで使わなくてもいいって言ったでしょ?
どうしてwarningのヒントがあるの?
すべて実行して成功することができますが、しかし不快に感じます!
最初の変更:
puts sayGoodnight("john-bo")


warningなしで実行
理由:
メソッド名と()にspaceは使用できません
BTW:
英語ができないのはこの悪いところがあって、waringのヒントさえ分かりません