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.
Basically, Sub() is a shortcut for Function() as Void. Staring from the docs
The statement "Sub" can be used instead of "function" as a shortcut to a function of Void return Type.
To exit early, you have some options. You do not need to have a return value (you can't) if you use Sub() or Function() as Void. If you don't specify a type, Function(), or use Function() as Dynamic, then you can return anything you'd like, but you must return something (invalid or not). If you do expect to always return a specific type, e.g. an integer, then use Function() as Integer, and return with valid integer.