Conditionally add, remove or change a tag?

The 2nd example is the same as here:
/t/3948/1
The two others are very similar.
To check if a tag field exist a simple $if(%tag%,yes,no) suffices.