How to use if statements for inspector in class?

I know this doesnt work but this is the only way i can explain it. How can i do something to this effect:

public Item myItem;
    
[System.Serializable]
public class Item
{
	public string name;
    
    if (name == "Weapon")     // How Can I make it show variable damage if it is a weapon?
    {
    	int damage = 10;
    }
}

void Start ()
{

}

void Update ()
{

}

How can i use if statements to show variables in the inspector?

Set damage as a public variable.
Also statements + logic are always called within the function/void brackets. Ponentional variables can be called from the class.

public int damage;

void Update() {
if(tag == "sword"){
int damage = 100;
}
if(tag == "dagger"){
int damage = 50;
}

}

The object this script is attached to has to have one of these tags. You can also do this in a switch/case statement. that should work a little bit cleaner.