I cannot talk about AI, but the Function below can be pasted:
Return A.ToString
End Function
So, it is easy to create one: I just did it !$Yes, this one is useless except for the demonstration.
To be sure, add a new Function with needed parameters / Return Type and populate the code area.
Then, Select your Function, Copy it, Delete it, Select the Module Name in the Navigator Pane and Cmd-P: it works fine here.
Now, I read the Issue and try to understand the “Problem” (to know if in that case, I am wrong)
About the Example 2:
Where is the Return Line ?
The Method below can be Pasted in a Module:
Public Sub ComputeXXXFromCloses(closes() As Double, fastPeriod As Integer, slowPeriod As Integer, signalPeriod As Integer, ByRef signal() As Double, ByRef hist() As Double)
Var n As Integer = closes.Count
macd.ResizeTo(n - 1)
signal.ResizeTo(n - 1)
hist.ResizeTo(n - 1)
//Do something more
End Sub
And the Function below can be Pasted:
Public Function ComputeXXXFromCloses(closes() As Double, fastPeriod As Integer, slowPeriod As Integer, signalPeriod As Integer, ByRef signal() As Double, ByRef hist() As Double) As Integer
Var n As Integer = closes.Count
macd.ResizeTo(n - 1)
signal.ResizeTo(n - 1)
hist.ResizeTo(n - 1)
//Do something more
Return n
End Function
I only add the line: Return n to the original code.
Conclusion: I do not understand what the problem is.
Care to explain, so I can understand ?