Learn
We can do more than just require
a module, however. We can also include
it!
Any class that include
s a certain module can use those module’s methods!
A nice effect of this is that you no longer have to prepend your constants and methods with the module name. Since everything has been pulled in, you can simply write PI
instead of Math::PI
.
Instructions
1.
In our case, we want to use Math::cos
but we don’t want to type Math::
.
Please include Math
on line 2.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.