29、Ruby中如何定义和使用方法?
要使用 Ruby 方法,需要先定义它。它是用 def 和 end 关键字定义的。方法名称应始终以小写字母开头。
def
end
语法:
def methodName code... end