mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 22:02:22 -05:00
macros4 solution
This commit is contained in:
parent
4cb15a4cda
commit
cc2c0958c9
2 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
|||
// TODO: Fix the compiler error by adding one or two characters.
|
||||
#[rustfmt::skip]
|
||||
macro_rules! my_macro {
|
||||
() => {
|
||||
|
|
|
@ -1 +1,15 @@
|
|||
// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
|
||||
// Added semicolons to separate the macro arms.
|
||||
#[rustfmt::skip]
|
||||
macro_rules! my_macro {
|
||||
() => {
|
||||
println!("Check out my macro!");
|
||||
};
|
||||
($val:expr) => {
|
||||
println!("Look at this other macro: {}", $val);
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
my_macro!();
|
||||
my_macro!(7777);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue