# Coordinate ring of affine variety

I was the given the following proof that $\mathbb{C}^2\setminus(0,0)$ is not an affine variety: $\mathcal{O}(\mathbb{C}^2\setminus(0,0))=\mathbb{C}[x,y]$, and if it were an affine variety then $\mathcal{O}(\mathbb{C}^2\setminus(0,0))=\mathbb{C}^2$. Why is that true?

for projective varieties I know that every regular function is constant. Is there anything similar on affine varieties?

What is true is that a morphism between affine varieties is an isomorphism iff it induces an isomorphism on their coordinate rings. The inclusion $i : \mathbb{C}^2 \setminus (0,0) \hookrightarrow \mathbb{C}^2$ induces an isomorphism $\text{res} : \mathcal{O}(\mathbb{C}^2 \setminus (0,0)) \to \mathcal{O}(\mathbb{C}^2)$, so if $\mathbb{C}^2 \setminus (0,0)$ were affine, then the inclusion would be an isomorphism, but it is not (e.g., it is not surjective).