1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-09-07 20:02:17 +02:00

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