Load
- loads a file (you were right!)
- As it loads a file, it has to have the extension and a path depending on its location
hello.rb
p 'Hi there'
File: test1.rb
load 'hello.rb'
p 'Willma'
Require
- require is smarter than load.
- It loads a library and prevents you to load it twice. If you try to do so... it will print "false" like saying "dumb" to you.
- You don't need to specify the rb extension. You can include the path depending on its location
hello.rb
p 'Hi there'
File: test1.rb
require 'hello'
p 'Willma'
0 comentarios:
Publicar un comentario