Clear Program before making new circuit

I can not find a way to clear my UNO :( I have worked with micro controllers before and this is always the first thing to do before wiring up a new circuit. I have searched the subject and it appears, against all reasonable logic, that one just builds a new circuit, then connect the power, which loads the previous circuit program. How can this not immediately destroy everything? Maybe I just am not understanding the most fundamental things here. I just received my UNO today and have the blink program running. I created a new sketch with nothing entered, clicked upload, but that does not clear it. So, if it is true that one just creates any circuit and powers it up with any program, that does not fry it, please explain why it does not destroy it. If there is a way to clear first, please post the sketch. Stuck at the plate for now, what do I do?

I’m not an expert, but i typically upload the new code, then build the circuit, then power the microcontroller. I’ve never come across a way to clear it, but im certain there is one. Hopefully someone else can answer the question more specifically.

You can just load a simple code, like blink.
Or a sketch that does nothing, part will power up with all IO as inputs:

void setup (){
while(1); // gets here & just sits …
}
void loop (){}

[edit - mis-named function corrected]

ty all for fast reply, CrossRoads post worked, but changed void sketch to void setup for those who may run across this thread. Now off to first base :)

Thanks, little too much on the mind today ...

Why bother to write your own ? The IDE comes with a program that does nothing apart from running the empty loop() function. No input, output, voltages on pins etc Look at the BareMinimum example.

UKHeliBob: Why bother to write your own ? The IDE comes with a program that does nothing apart from running the empty loop() function. No input, output, voltages on pins etc Look at the BareMinimum example.

You can get the BareMinimum example by using the IDE's menu. F*ile->New. It will pop up a new IDE window containing a sketch with a setup() and loop(). Upload that, and build your circuit. Rename it by using **File->Save As*.

File/New just gives me a blank edit window here in 1.0.5. What version of the IDE are you using ?

UKHeliBob: File/New just gives me a blank edit window here in 1.0.5. What version of the IDE are you using ?

Interesting. I'm using 1.5.4