title: Difference between require and load wrt to "load" and "execute"
body: <p>Below are some snippets from the documentation for <code>Kernel</code>:</p>
  
  <p><a href="https://ruby-doc.org/core-2.2.3/Kernel.html#method-i-load" rel="nofollow noreferrer">Kernel#load</a></p>
  
  <blockquote>
    <p>Loads and executes the Ruby program in the file filename...</p>
  </blockquote>
  
  <p><a href="https://ruby-doc.org/core-2.2.3/Kernel.html#method-i-require" rel="nofollow noreferrer">Kernel#require</a></p>
  
  <blockquote>
    <p>Loads the given name...</p>
  </blockquote>
  
  <p>I know there are differences between <code>require</code> and <code>load</code> for example:</p>
  
  <ul>
  <li><code>require</code> will tack on an <code>rb</code> extension while <code>load</code> will not</li>
  <li><code>require</code> will store the ruby file path inside <code>$LOADED_FEATURES</code> aka <code>$"</code> while <code>load</code> will not</li>
  <li><code>require</code> will search <code>$LOADED_FEATURES</code> before "loading" the file again while <code>load</code> will not</li>
  </ul>
  
  <p>I'm wondering about the distinction between the word "load" and the word "executes".</p>
  
  <p>The documentation makes it seem like they are two different things. To me, "load" would mean "Hey I know about this file now" while "execute" would mean "Hey I know about this file now and I'm going to run all the commands also"</p>
  
  <p>But I don't think that's right.</p>
  
  <p>For example, given the following structure:</p>
  
  <pre><code>$  tree
  .
  ├── bar.rb
  ├── baz.rb
  └── foo.rb
  
  0 directories, 3 files
  </code></pre>
  
  <p>with foo.rb:</p>
  
  <pre><code>$LOAD_PATH &lt;&lt; __dir__
  require 'bar'
  load 'baz.rb'
  </code></pre>
  
  <p>bar.rb:</p>
  
  <pre><code>puts "Inside of bar..."
  </code></pre>
  
  <p>baz.rb:</p>
  
  <pre><code>puts "Inside of baz..."
  </code></pre>
  
  <p>When I run <code>foo.rb</code> I would expect "Inside of baz..." to print but not "Inside of bar..." because <code>load</code> "loads and executes" while <code>require</code> just "loads". But what actually happens is both seem to "execute":</p>
  
  <pre><code>$  ruby foo.rb
  Inside of bar...
  Inside of baz...
  </code></pre>
  
  <p>So is there a difference between "loading" and "executing" a ruby file?</p>