# !/usr/bin/ruby -w # -*- encoding:utf-8 -*- # filename: main.rb # author: 简单教程(www.twle.cn) # Copyright © 2015-2065 www.twle.cn. All rights reserved. GLOBAL_CONST_VAR = "www.twle.cn" class HelloWorld VAR1 = 1 VAR2 = 3 def show puts "第一个常量的值为 #{VAR1}" puts "第二个常量的值为 #{VAR2}" puts "全局的常量 GLOBAL_CONST_VAR 值为: #{GLOBAL_CONST_VAR}" end end object=HelloWorld.new() object.show