Functions (abbreviated as “func”) are basically commands that return a value. The syntax is mostly the same. The only change in the declaration is the addition of a return type. You can call them as you would a procedure unless you call them inside another statement. In that case, you need to enclose the parameters in parentheses.
function myFunc [\Left\ left#] [\Right\ right#] returns int ' Do something return 3
Notice the return type is on its own line and is double indented. This is to make it stand out. (The exception is a function in prototype-form only such as you would have inside an interface or when declaring a delegate. See [Interfaces] and [Delegates] for those details.) Early returns are allowed.
myFunc Left 3 ' Return value ignored var x# = myFunc Right 37 ' Valid as long as you aren’t calling myFunc inside another function, procedure, or complex statement. print myFunc Left 34 Right 343 ' Invalid!!!! print myFunc(Left 34 Right 343) ' Correct
Wiki: When is it a procedure, command, function, property, property accessor, method, complex statement, or type cast?