- 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.
推薦閱讀
- 深入核心的敏捷開發:ThoughtWorks五大關鍵實踐
- Mastering JavaScript Functional Programming
- Ceph Cookbook
- Learning Elixir
- Building Minecraft Server Modifications
- Hands-On GPU:Accelerated Computer Vision with OpenCV and CUDA
- 精通Python自然語言處理
- Extreme C
- Azure Serverless Computing Cookbook
- 零基礎學Scratch 3.0編程
- WildFly Cookbook
- Python Social Media Analytics
- 從零開始學Unity游戲開發:場景+角色+腳本+交互+體驗+效果+發布
- Java服務端研發知識圖譜
- Yii框架深度剖析