RobotStudio event

Function returns an array

Hello,

I'm trying to create a function that return an array of 4, data type bool. I thought creating a record for this purpose is an overkill. Can anyone help me please? Thank you.

Best Answer

Answers

  • Micky said:
    Hi,

    a function can not return an array but you can use a procedure which returns the modified array.

    Please refer also to the following thread "Return an array of num from a function"

    Example:

    proc Example()
      var bool bArray{4};

      !Call routine to set the data of the array
      ModifyArray bArray;
    endproc

    !Array will be handled as by reference and returns the modfied values
    proc ModifyArray(INOUT bool array{*}
      !use function DIM to get the size of the handed over array
      for i from 1 to DIM(array,1) do
        array{i}:=....
      endfor
    endproc

    /BR
    Micky



    Thank you!