Minecraft wiki entry for execute, associated text: Teleport all players who have an item enchanted with Efficiency in their first hotbar slot to coordinates (0, 64, 0):
/execute as @a if data entity @s Inventory[{Slot:0b}].tag.Enchantments[{id:"minecraft:efficiency"}] run tp @s 0 64 0
Create a smoke particle three blocks in front of all players:
/execute as @a at @s anchored eyes run particle smoke ^ ^ ^3
Place a saddle on pigs located within 5 blocks of the executing player, and remove saddles from pigs located over 5 blocks away from the executing player:
/execute as @e[type=pig] at @s store success entity @s Saddle byte 1 if entity @p[distance=..5]
Make a player say "My feet are soaked!" in chat if they are located in a block of water:
/execute as @a at @s if block ~ ~ ~ water run say "My feet are soaked!"
Make a player say "Score is reset" in chat if the score 'test' is not set, eg by doing "scoreboard players reset @s test":
/execute as @a unless score @s test = @s test run say "Score is reset"
Hurl all pigs skyward who are within 3 blocks of the nearest player:
/execute at @p as @e[type=pig,distance=..3] run data merge entity @s {Motion:[0.0,2.0,0.0]}
Kill all zombies who have no headgear:
/execute as @e[type=zombie] unless data entity @s ArmorItems[3].id run kill @s