Imports
Using Libraries

Import statements allow you to import libraries of code. These libraries make available subprograms that do very useful things, such as opening a web browser:
import web

openWebBrowser("www.google.com")
There's also the import into statement. This allows you to import a library's variables and subprograms into an object.
import math into m

print m              //Prints the object m, so you can see all variables and subprograms inside it.
print m.sin(m.pi)    //The sine of pi, which is 0 (Mint prints an approximation to 0).
You can also import other Mint files using the import statement. For example, pretend that we put the complex number subprogram from the Objects lesson into a file called "complex.mint". You could then import the subprogram by doing:
import "complex.mint"
Here's a list of all built-in libraries that you can import:
operator
math
type
time
system
file
web
mint
graphics
thread
random
compress
programming
data.mint
For the last one, use import "data.mint".

Navigation
Previous Lesson: Memory Management
Next Lesson: Operator Overloading
Table of Contents