Forgot password?

Create an account!

Forum

« back

RhinoScript – How to return two variables in a function

Messages

Please log in to write a message.

  • 3. Ning (Jun 11, 2010 12.48):

    johannes,

    Thank you a lot. The way works well.

    Best Wishes

    Ning

  • 2. Johannes (Jun 11, 2010 12.18):

    Hi,

    you can solve it with an array as output...

    Call Main()
    Sub Main()

            Dim arrOut     
            arrOut = testOut()

            Call MsgBox("01: " & arrOut(0) & "  02: " & arrOut(1))  
           
    End Sub

    Function testOut()

            Dim arrResult
            ReDim arrResult(1)
           
            arrResult(0) = "1st output"
            arrResult(1) = "2nd output"

            testOut = arrResult

    End Function

    johannes

  • 1. Ning (Jun 11, 2010 12.07):

    Hi, there

    Normally a function returns a variable below.

    Function test()
    ....
    test= arrVariable1

    End Function

    I am wondering how to return two variables in a function

    Function test()
    ....
    test= (arrVariable1,arrVariable2)

    End Function


    Thank you for your guide.

    regards

    ning

Recommend

Why are these buttons gray?