We can do more than just require a module, however. We can also include it!

Any class that includes 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.



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

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?