Creating code based on value of macro agrument rust

macro_rules! retry_put {
($mod_name:ident, $data_type:ty) => {{
    fn $mod_name() {
      // somelike
       if $mod_name == "red" {
       // generate code written here and not the one in else block
         return u8;
       }
       else {
       // generate code written here and not the one in if
         return "string";
       }
     }
   }
  }

I am tring to change the return type based on input basically, if input is true return string else return int.

Or maybe give example for : give example where we are accepting a arguement in macro and if its even calulate factorial of 5 and return it as integer and if the agruement is odd calculate the factoreial of 5 and return it as string. And name of both functions should be same. and logic of calculating 5! should not be repeated.

It sounds like you want an enum actually:

enum Answer {
    Int(usize),
    String(String),
}