'脚本语⾔言' features << '开放源代码' # 使⽤用特性 features << '⾯面向开发者设计的语⾔言' features << '丰富的语法糖' features << '实际问题的快速解决⽅方案' # 技术特性 features << "Mixins" features << "消息传递" features << "闭包、函数式编程" features << "庞⼤大的标准库" features << "Rubygems 管理包⼯工具" features << "⾃自动垃圾回收机制" features << "动态类型和鸭⼦子类型" features << "操作重载" features << "⽀支持灵活强⼤大的 DSL 语法定义" end
puts i end # same above, all the block [1, 2, 3, 4, 6 - 1].each {|i| puts i} {apple:(6.5 * 4), banana:12, orange:8.5}.each do |name, price| puts "#{name} price is #{price.to_s}" end
@name = name end def say_hello puts "hello, mobile guy! #{name}" end end end end user = Qyer::Mobile::User.new(‘icyleaf’) user.say_hello module Qyer module Web class User attr_accessor @name def initialize(name) @name = name end def hello puts "hello, web guy! #{name}" end end end end user = Qyer::Web::User.new(‘master huang') user.say_hello