I know there's no straightforward way for multiple assignment of function in VB
, but there's my solution - is it good, how would you do it better?
What I need (how would I do it in python, just an example)
def foo(a) ' function with multiple output
return int(a), int(a)+1
FloorOfA, CeilOfA = foo(a) 'now the assignment of results
How I do it in VB:
Public Function foo(ByVal nA As Integer) As Integer() ' function with multiple output
Return {CInt(nA),CInt(nA)+1}
End Function
Dim Output As Integer() = foo(nA) 'now the assignment of results
Dim FloorOfA As Integer = Output(0)
Dim CeilOfA As Integer = Output(1)
CInt(nA)
whennA
is already anInteger
. – Numeration