Pure vs impure functions

A pure function is one that computes a result which is always the same given the same arguments and it does not change any outside state. You call pure code to one which could be extracted into a pure function.

int square(const int number) {
    return number * number;
}

An impure function is one that affects the state of some part of the program. It could change one of its arguments or modify the state of an outside object, for example. You call impure code to one which could be extracted into an impure function.

int processCard(CardNumber& card_number) {
    card_number.modify_number(1, 2);
}

Pure code is much easier to test than impure code. That is why separating both can help you put tests in place when working with legacy code.