2014/07/20 00:20:15 - Ruby, Web, basic Ruby 中變數的種類 Ruby 中的變數有四種,根據有無 prefix 和 prefix 種類不同,各種的作用域及功能都不一樣。 無 prefix :普通的 local variable , scope 根據所在位置而定。 有 prefix @ : instance variable , based on its class ,無法由外部存取 @@ : class variable ,屬於 class 的 attribute $ : global variable ,全域的變數。