[ncl-talk] function return value

Dennis Shea shea at ucar.edu
Wed Mar 30 21:18:16 MDT 2016


function foo(...)
local x, y
begin
    :
    x = ...
    y = ...
    return( [/x, y/] )   ; return as variable of type 'list'
end

    ....
    ...
    ab = foo(...)
    print(ab)     ; look at output

    a  = ab[0]   ; clarity
    b  = ab[1]
    delete(ab)

====
Note: you could use 'ab[0]'  and  'ab[1]' but I find it clearer to
explicitly extract each variable

Good Luck

On Wed, Mar 30, 2016 at 9:01 PM, Sitan Heyl <heylsitan at gmail.com> wrote:

> Hi, All
>   I am writing an function file defined by myself, I need return two
> arrays, does anyone know how the function return two arrays?
>
> Best,
> Yongli
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160330/c45d6d0b/attachment.html 


More information about the ncl-talk mailing list