macros4 solution

This commit is contained in:
mo8it 2024-07-01 11:54:05 +02:00
parent 4cb15a4cda
commit cc2c0958c9
2 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,4 @@
// TODO: Fix the compiler error by adding one or two characters.
#[rustfmt::skip] #[rustfmt::skip]
macro_rules! my_macro { macro_rules! my_macro {
() => { () => {

View file

@ -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);
}