How do I exit from a function?

Use the return statement.

MSDN Reference