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") a =[1,'cat',3.14] a[0]=nil puts a b=%w{jake heidsoft heidcloud} #散列 =>左边是建,右边是值 cloud_system={ 'java' => 'CloudStack', 'Python' =>'OpenStack', 'c/c++' =>'OpenNebula' } puts cloud_system['java'] puts cloud_system['Python'] count=1 tries=2 if count>3 puts 'java' elsif tries=3 puts 'python' else puts 'c/c++' end weight=0 hight=100 # while weight <100 and hight<=200 # count+=1 # end # puts count while line=gets puts line.downcase end #nil=false if count>100 puts "count > 100" end #这种写法和上面的一样 puts "count > 100" if count>100 square =2 while square <1000 square=square*square end
黑洞@heidsoft
Github:https://github.com/heidsoft
微博:http://weibo.com/liuganbin
热衷云计算和大数据
关注CloudStack,OpenStack,Linux c/c++/python/java
关注研究新技术