掃碼下載編程獅APP
#!/usr/bin/ruby # -*- coding: UTF-8 -*- class Example VAR1 = 100 VAR2 = 200 def show puts "第一個(gè)常量的值為 #{VAR1}" puts "第二個(gè)常量的值為 #{VAR2}" end end # 創(chuàng)建對(duì)象 object=Example.new() object.show