mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-04 17:23:36 +02:00
modules1 solution
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user