Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mod english {
- pub fn hello(name: &str) {
- println!("Hello, {}", name);
- }
- }
- mod chinese {
- pub fn hello(name: &str) {
- println!("你好,{}", name);
- }
- }
- fn main() {
- // Call modules
- use english;
- use chinese;
- // Call two functions with the same name
- english::hello("Michael");
- chinese::hello("麥可");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement