4 Replies Latest reply on May 27, 2018 1:48 AM by Artem Taturevych

    Returning multiple values from a function

    Harold Black

      I have created a custom function named Create_pt in my code in which it calculates a x coordinate and y coordinate, xpt and ypt respectively. The reason for using a function is because I reuse the same block of code elsewhere. How do I return the values for xpt and ypt from the function? The help file said that if I want to return a value from the function I assign the value to the function name. Within my function I did Create_pt(0)=xpt

      Create_pt(1)=ypt

       

      In my main code I reference these values just by doing Create_pt(0) or Create_pt(1) but when I run my main code I get "Argument not optional" and it points to the location where I have tried this. What am I doing wrong? I can't seem to find an example of passing a variant out.