title: Is there a "main" method in Ruby like in C?
body: <p>I'm new to Ruby, so apologies if this sounds really silly.</p>
  
  <p>I can't seem to figure out how to write a "main" code and have methods in the same file (similar to C). I end up with a "main" file which loads a seperate file that has all the methods. I appreciate any guidance on this. </p>
  
  <p>I spotted the following SO post but I don't understand it:
  <a href="https://stackoverflow.com/questions/582686/should-i-define-a-main-method-in-my-ruby-scripts">Should I define a main method in my ruby scripts?</a></p>
  
  <p>While it's not a big deal, it's just easier being able to see all the relevant code in the same file. Thank you.</p>
  
  <p>[-EDIT-]</p>
  
  <p>Thanks to everyone who responded - turns out you just need to define all the methods above the code. An example is below:</p>
  
  <pre><code>def callTest1
      puts "in test 1"
  end
  
  def callTest2
      puts "in test 2" 
  end
  
  callTest1
  callTest2
  </code></pre>
  
  <p>I think this makes sense as Ruby needs to know all methods beforehand. This is unlike C where there is a header file which clearly list the available functions and therefore, can define them beneath the main() function</p>
  
  <p>Again, thanks to everyone who responded.</p>