- Comprehensive Ruby Programming
- Jordan Hudgens
- 100字
- 2021-07-02 21:13:24
Class variables
Class variables are variables that are available to a particular class. The syntax for this variable is @@. Consider this example:
class MyClass
@@teams = ["A's", "Tigers"]
end
Though they look simple, you'll rarely use class variables in real-world applications because you can accomplish the same using local or instance variables. Nothing is wrong if you use class variables, but it's not commonly utilized by most developers. In fact, the local and instance variables are likely to make up more than 98 percent of variables in your applications, so it's a good idea to be familiar with them.
推薦閱讀
- 深入理解Android(卷I)
- Developing Mobile Web ArcGIS Applications
- Android Application Development Cookbook(Second Edition)
- 三維圖形化C++趣味編程
- Elastic Stack應(yīng)用寶典
- The Data Visualization Workshop
- 新一代SDN:VMware NSX 網(wǎng)絡(luò)原理與實(shí)踐
- INSTANT Yii 1.1 Application Development Starter
- 深入淺出Go語(yǔ)言編程
- Hands-On Neural Network Programming with C#
- Laravel Design Patterns and Best Practices
- 分布式數(shù)據(jù)庫(kù)HBase案例教程
- Elasticsearch搜索引擎構(gòu)建入門與實(shí)戰(zhàn)
- JavaScript語(yǔ)法簡(jiǎn)明手冊(cè)
- AI輔助編程Python實(shí)戰(zhàn):基于GitHub Copilot和ChatGPT