UNO rev 3 and MEGA 2560 rev 3 sketch compatibility?

Are the UNO sketches/programming compatible with the MEGA boards? I have the Uno and would like to purchase the MEGA. However, i would like to transfer the UNO sketch exactly as it appears on the arduino IDE. Can i just upload the same sketch i have on the uno into the MEGA? Please excuse my newbish questions.

RobV15:
Are the UNO sketches/programming compatible with the MEGA boards? I have the Uno and would like to purchase the MEGA. However, i would like to transfer the UNO sketch exactly as it appears on the arduino IDE. Can i just upload the same sketch i have on the uno into the MEGA? Please excuse my newbish questions.

In almost all cases sketches written for a Uno board will run correctly on a Mega board without modificatoin. There are some infrequently used programming practices like using direct port I/O pin manipulations where the code won't operate on the same pins on the mega as on the Uno but they can be easily changed.

Going the other way can be harder as code written on a mega might be too large to fit in a Uno, or use more pins then a uno board has, or use more timers, etc.

Lefty