Why doesnt my else work

ok so im trying to make my own type of inventory because i dont want it to be like the others but i keep running into this problem that it picks up like 2 time but i cant explain it in typing so ill show you in code

public IObject Item;
    public PTool Tool;
    public PWeapon Weapon;

  void PickUp()
    {
        RaycastHit _hit;
        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out _hit))
        {
            IObject ItemObject = _hit.collider.GetComponent<IObject>();


            if (ItemObject)
            {
                if (ItemObject.GetComponent<PTool>())
                {
                    if (ItemObject.GetComponent<PTool>() && Tool == null)
                    {
                        Tool = ItemObject.GetComponent<PTool>();
                    }else { if (Item == null) { Item = ItemObject; } }
                }
                else
                {
                    if (ItemObject.GetComponent<PWeapon>())
                    {
                        if (ItemObject.GetComponent<PWeapon>() && Weapon == null)
                        {
                            Weapon = ItemObject.GetComponent<PWeapon>();
                        }else { Item = ItemObject; }
                    }else { if (Item == null) { Item = ItemObject; } }
                }
             }     
          }      
       }

If the ‘else’ that you meant was the ones related with these GetComponent() conditions like:

if (ItemObject.GetComponent<PTool>()) {...}else{...}

or

if (ItemObject.GetComponent<PWeapon>()) {...}else{...}

Then it seems that you want to check the availability of the component, hence I suggest you try change them into this:

if (ItemObject.GetComponent<PTool>()!=null){...}else{...}

and this

if (ItemObject.GetComponent<PWeapon>()!=null)