Asked 7 years ago
7 Jan 2017
Views 1001
noob

noob posted

difference between include and require in Ruby?

what is difference between include and require in Ruby?
include seems to include file and require seems to only if file is required. so am guessing good ?

include vs require in Ruby , need to know pros and cons of include and require in Ruby .
Phpworker

Phpworker
answered Nov 30 '-1 00:00

include means include file and don't generate any critical error if there is error like file is not found in Ruby .
require means file must be included . if file is not found or file is not included than program should be stop run because its very very much required to run before next set of code run so it is called require
include - loose file inclusion and require is tight file inclusion in Ruby
in Ruby , include will generate error but dont stop run of the code and require stop the execution of the code if any error is there , mostly file not found error stop it .
Post Answer