title: How to reference global variables and class variables?
body: <p>I'm new to programming. Right now I'm studying Ruby. To my understanding, global variables are defined in the global namespace (so outside of any classes or functions). I'm reading something and it says global variables have a <code>$</code> sign before them. What does that mean? Does it mean when I define a function or class and want to reference my global variable (let's say it is <code>edmund = 123</code>) I would have to reference it like this: <code>$edmund</code>?</p>
  
  <p>so:</p>
  
  <pre><code>edmund = 123
  def my_function()
    456 + $edmund
  end
  </code></pre>
  
  <p>Also are class variables (the ones that begin with <code>@@</code>) like instance variables (<code>@</code>) where you can access them by calling them through <code>Class.classvariable</code>? What is their purpose?</p>