- 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.
推薦閱讀
- Spring Boot 2實戰之旅
- Visual Basic編程:從基礎到實踐(第2版)
- The React Workshop
- Python貝葉斯分析(第2版)
- Building an RPG with Unity 2018
- Building Serverless Applications with Python
- Python算法指南:程序員經典算法分析與實現
- Mastering Android Game Development
- Flowable流程引擎實戰
- BeagleBone Robotic Projects(Second Edition)
- Learning VMware vSphere
- Mastering SciPy
- Spring Data JPA從入門到精通
- 零基礎學SQL(升級版)
- 少兒編程輕松學(全2冊)