rustlings/exercises/21_macros/macros4.rs

16 lines
305 B
Rust
Raw Normal View History

2024-10-28 20:46:17 +00:00
// TODO: Fix the compiler error by adding one or two characters.
#[rustfmt::skip]
macro_rules! my_macro {
() => {
println!("Check out my macro!");
2024-11-09 11:43:57 +00:00
};
2024-10-28 20:46:17 +00:00
($val:expr) => {
println!("Look at this other macro: {}", $val);
2024-11-09 11:43:57 +00:00
};
2024-10-28 20:46:17 +00:00
}
fn main() {
my_macro!();
my_macro!(7777);
}