Shorter toggle script?

Simple function that disables a script that toggles me to switching weapon when the player is scoped in, however how can it be done easier? (Such as without the “else”) I know it’s not big code, but would help me out in the future projects. Thanks.

The code by @Arocide is not equivalent to yours. But the following is :

     weaponSwitch.enabled = !Input.GetButtonDown("Fire2");
     wepSwitch = weaponSwitch.enabled ? wepSwitch : !wepSwitch ;

But keep in mind that Input.GetButtonDown is called one frame only, thus, weaponSwitch will be disabled one frame only.

From what I can see it could potentially be ‘shortened’ to:

       wepSwitch = weaponSwitch.enabled = !Input.GetButtonDown("Fire2");

Would be functionally equivalent, but you must also ask yourself which is more readable because readability is important in programming and scripting. It’s not always about the shortest way however if this solution is more readable to you then if else blocks then by all means go for it.