mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-25 06:57:31 -05:00
macros1 solution
This commit is contained in:
parent
a13e3cd07f
commit
cf90364fd7
3 changed files with 13 additions and 4 deletions
|
@ -5,5 +5,6 @@ macro_rules! my_macro {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// TODO: Fix the macro call.
|
||||||
my_macro();
|
my_macro();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1089,9 +1089,8 @@ name = "macros1"
|
||||||
dir = "21_macros"
|
dir = "21_macros"
|
||||||
test = false
|
test = false
|
||||||
hint = """
|
hint = """
|
||||||
When you call a macro, you need to add something special compared to a
|
When you call a macro, you need to add something special compared to a regular
|
||||||
regular function call. If you're stuck, take a look at what's inside
|
function call."""
|
||||||
`my_macro`."""
|
|
||||||
|
|
||||||
[[exercises]]
|
[[exercises]]
|
||||||
name = "macros2"
|
name = "macros2"
|
||||||
|
|
|
@ -1 +1,10 @@
|
||||||
// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
|
macro_rules! my_macro {
|
||||||
|
() => {
|
||||||
|
println!("Check out my macro!");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
my_macro!();
|
||||||
|
// ^
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue