def say_goodnight(name) result ="Good night ." +name return result end def say_goodmorning(name) result ="Good morning .#{name}" return result end def say_goodafternoon(name) result ="Good afternoon .#{name}" end puts say_goodnight("jake") puts say_goodmorning("heidsoft") puts say_goodafternoon("heidcloud")
局部变量、方法参数和方法名称都必须以小写字母和下划线开始
全局变量,以($)为前缀
实例变量,以(@)符号开始
类变量,以(@@)两个@符号开始
类名称、模块名称和常量都必须以一个大写字母开始
黑洞@heidsoft
Github:https://github.com/heidsoft
微博:http://weibo.com/liuganbin
热衷云计算和大数据
关注CloudStack,OpenStack,Linux c/c++/python/java
关注研究新技术