In this situation, i use ESP8266 for delate the coding. Actually i don't really sure if it's work, i hope you'll can tell me what is wrong, thank you.
for checking:
First, plug into your computer(i use micro USB blue transparent), for checking, click WINDOW and X > DEVICE MANAGER > Port (COM & LPT) if you see that your USB show the emoji, it means you need to update it. Because i use ESP8266 and my USB say that my name Port is "CP210", i must go to the silabs.com find the CP210 and click the DOWNLOAD > LATEST VERSION, then go back to the DEVICE MANAGER find the Port, click update, and put the zip into the url, click next and your done(THIS TUTORIAL FOR SOLVE THE PORT PROBLEM(IF THE PORT DOESNT SHOW AT YOU ARDUINO IDE, IT MEANS YOU NEED TO DO MY TUTORIAL, IF YOU NOT DO IT, YOU CANT UPLOD YOUR CODE.)
THE POINT(delete the coding):
First, check in TOOLS choose your board and check how fast that your board can suitable, for me choose 115200. If you done, and everything is alright, lets go to the coding step.
What problem is the post meant to solve? Is it about just clearing an exiting sketch from the board? If you upload a basic sketch such as the one you show in your post, then yes, it will overwrite the previous contents with a sketch that does almost nothing and is one way to clear the board to, in effect, its initial state.
No, you don't 'delete the coding'. You simply replace the existing code with a new one that does not do anything noticeable to the user. But every uploading a sketch overwrites the existing one - so this is not really something special.
About what problem i solve, i actualy strugling 6 hour for solve a port problem, if someone was confused about the port then they don't need to go to youtube for tutorial, haha sorry if its made you confuse and thank for read!
It is wrong because it is pointless and unnecessary, not anything to celebrate or be proud about. There is no advantage to removing your previous code. Next time you upload code, it will automatically replace the previous code. No extra steps are necessary to remove the previous code.