- 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.
推薦閱讀
- Visual C++數(shù)字圖像處理技術(shù)詳解
- Building Serverless Applications with Python
- Node.js Design Patterns
- Spring核心技術(shù)和案例實戰(zhàn)
- Magento 2 Beginners Guide
- 算法設(shè)計與分析:基于C++編程語言的描述
- 高效使用Greenplum:入門、進(jìn)階與數(shù)據(jù)中臺
- 交互設(shè)計師成長手冊:從零開始學(xué)交互
- 基于MATLAB的控制系統(tǒng)仿真及應(yīng)用
- C語言程序設(shè)計實驗指導(dǎo)
- 深度剖析ApacheDubbo核心技術(shù)內(nèi)幕
- 嵌入式網(wǎng)絡(luò)編程
- 自學(xué)Python:編程基礎(chǔ)、科學(xué)計算及數(shù)據(jù)分析
- 深入解析Java虛擬機(jī)HotSpot
- 編程改變生活:用PySide6/PyQt6創(chuàng)建GUI程序(進(jìn)階篇·微課視頻版)