I think of a function as a computer, you put in numbers and you get them out.
The set of numbers you put in is the DOMAIN.
The set of numbers you EXPECT to get out is the CODOMAIN.
The set of numbers that you actually do get out is the RANGE. Note that the range is always a subset of the Codomain.
E.g. the function .
If you put in any real number other than 0, you would expect to get out a real number. But of course, you can not get out 0.
So that means the domain is , the codomain is and the range is .
If we were to write this in full function notation it would be