difference b/w Sub and Function

Hi
i am willing to know that what is the actual difference b/w Sub and Function. If i am not wrong Sub is using for return type void. But as a roku prospect i want to know that from where we should use SUB and where we should use FUNCTION keyword.
please suggest me with example.

and If i want to exit from function forcefully.what is the method there. if i use return keyword it should have some value.