def say_goodnight(name) result ="Good night ." +name return resultenddef say_goodmorning(name) result ="Good morning .#{name}" return resultenddef say_goodafternoon(name) result ="Good afternoon .#{name}" endputs say_goodnight("jake")puts say_goodmorning("heidsoft")puts say_goodafternoon("heidcloud")
局部变量、方法参数和方法名称都必须以小写字母和下划线开始
全局变量,以($)为前缀实例变量,以(@)符号开始类变量,以(@@)两个@符号开始类名称、模块名称和常量都必须以一个大写字母开始