Here is an example of a function which I believe to be onto and not 1-1:
$f: \mathbb{N} \to \mathbb{N}$
$f(n) = \begin{cases} 0 &\text{if} \quad n=0\\ 0 &\text{if} \quad n=1\\ n-1 &\text{otherwise}\\ \end{cases}$
It is not 1-1 because f(0) and f(1) both map to 0. It is onto because for every $y$ in the codomain, there is a value $x$ in the domain for which $y=f(x)$.
Fine. But this is causing me mental dissonance because I don't understand how you can say that all codomain values are mapped given the following: In programming, $y=f(x)$ doesn't take on a value until $f$ is called.
Even then the largest values in the codomain won't be mapped until some call to $f(x)$ yields their value.
There are other places in studying math where the lack of instantiation of values doesn't seem to invalidate the definition of concepts, and I think it will help me to move forward as a student if someone can explain to me what is going on here, and why I shouldn't worry about the fact that the definition seems to assume that all functions are always simultaneously instantiated, allowing mathematicians to make claims about their values.