title: Why is code inside of classes executed automatically when I run a ruby script?
body: <p>When I write the following program,</p>
  
  <pre><code>class Classname
    puts "hi"
  end
  </code></pre>
  
  <p>save it as a .rb file, and execute the file in terminal, the output "hi" is returned. I don't understand why. Don't I have to assign that puts statement to a method, create an object of the Classname class, and then call the method on said object to get that output? Or at least put the puts statement in the initialize method of the class, and then create an object? Why does this work the way it is?</p>