What is the difference between require() and library()?

前端 未结 8 1093
情话喂你
情话喂你 2020-11-22 11:00

What is the difference between require() and library()?

8条回答
  •  孤街浪徒
    2020-11-22 11:38

    My initial theory about the difference was that library loads the packages whether it is already loaded or not, i.e. it might reload an already loaded package, while require just checks that it is loaded, or loads it if it isn't (thus the use in functions that rely on a certain package). The documentation refutes this, however, and explicitly states that neither function will reload an already loaded package.

提交回复
热议问题