Hi, there.

I saw a sentence:

Portability means that the same source code can be compiled and run in a different execution environment than that for which it was written.

I can't understand the meaning of it started from "than that for which it was written".

I barely can deduce that: it = the same source code; which = in a different execution environment.

The second independent clause maybe is : The same source code was written in a different execution environment. Or

The same source code was written for a different execution environment.

But I don't know how"than that" works in this sentence and exactly sentence is.

regards, Andy