单引号与双引号的差别: 与shell中类似, 单引号中的内容不会被转义, 双引号中的内容会被转义. 测试代码如下:
name='butnet'
puts 'hello \t #{name}'
puts "hello \t #{name}"
=begin
输出结果:
hello \t #{name}
hello butnet
=end
类初始化方法名: initialize
创建类的内容使用类的 new方法
class Test
def initialize
puts 'initialize'
end
end
a = Test.new
=begin
initialize
=end
ruby的多行注释以=begin开始, 以=end结束, 单行注释使用 井号 "#"