I am trying to make an explosive snowball, but I need to test if there is air or a block under the snowball. I tried tags so when it is in the air the snowball gets a tag "air":

/execute as @e[type=minecraft:snowball] at @e[type=minecraft:snowball] if block ~ ~-1 ~ minecraft:air run tag @s add air

But I realized it would not remove the tag if the condition was false.

Is there a block name or something I can put in, like /execute as @e[type=minecraft:snowball] at @e[type=minecraft:snowball] if block ~ ~-1 ~ !minecraft:air run summon tnt ~ ~ ~ {Fuse:0} ?

marked as duplicate by Fabian Röling, galacticninja, Ivo Coumans, Virusbomb, B. S. Morganstein Aug 12 at 20:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.