November 2017
Intermediate to advanced
264 pages
5h 45m
English
The use keyword like in use game1::func2; imports a func2 function from the game1 module, so that it can simply be called with its name, func2(). You can even give it a shorter name with use game1::func2 as gf2; so that it can be called as gf2().
When the module game1 contains two (or more) functions, func2 and func3, that we want to import, this can be done with use game1::{func2, func3};.
If you want to import all (public) items of the module game1 you can do it with *:
use game1::*;
However, using such a global import is not best practice, except in modules for testing. The main reason is that a global import makes it harder to see where names are bound. Furthermore, they are forward-incompatible, ...
Read now
Unlock full access