ruby要求常量首字母要大写
但是为了可读性,建议全部大写
而且, 说是常量, 却是可变的, 但是会有警告
PI = 3.14
puts "PI = #{PI}"
# ----------------
PI = 314
puts "PI = #{PI}"
控制台会输出
PI = 3.14
E:/application/Aptana/Aptana Studio 3/workspace/TestRuby/pkg/Test_002_constant.rb:4: warning: already initialized constant PI
PI = 314