Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有代码@array = array。把@标志放在前面array有什么用?
@array = array
@
array
表单@<something>中的变量是 Ruby 中的实例变量。它们是您在其中创建它们的类的一部分。
@<something>
例如在:
class Something def initialize(x) @x = x end end
@x是类的实例变量,Something而是x方法的简单局部变量initialize。
@x
Something
x
initialize