modules1 solution

This commit is contained in:
mo8it
2024-06-22 13:12:39 +02:00
parent 879f0cd5c6
commit ecbe9b7324
3 changed files with 18 additions and 4 deletions
+15 -1
View File
@@ -1 +1,15 @@
// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
mod sausage_factory {
fn get_secret_recipe() -> String {
String::from("Ginger")
}
// Added `pub` before `fn` to make the function accessible outside the module.
pub fn make_sausage() {
get_secret_recipe();
println!("sausage!");
}
}
fn main() {
sausage_factory::make_sausage();
}