Merging Two Codes?

I was wondering if you had two or more different sketches if you could combine them or run them independently without interfering with the other and all on the one board? (Arduino Mega 2560)

Thanks