[gradsusr] what does "args" mean in grads

Ricardo Hallak hallak at model.iag.usp.br
Wed Sep 26 10:36:22 EDT 2012


Hi Farah,

example:

* Calling a function and passing 4 arguments in the main script:
a=test(theta,pressure,u,v)

Outside of the main script, you write a function, as the function "test" below:

function test(args)
PotTemp=subwrd(args,1)
Press=subwrd(args,2)
ZonalW=suvwrd(args,3)
MeridW=subwrd(args,4)

*Some calculation in the function

a1=(ZonalW*ZonalW)+(MeridW*MeridW)

return a1

As a final result, a1 will be passed to the variable "a" in the main script.

Hope this helps,
Ricardo

On Wed, 26 Sep 2012 02:09:15 -0700, Farah Ikram wrote
> hi,
> i am trying to make a function, the syntax i read in grads manual is funtion name(args). but it is not clear to me that what does "args" comand do actually.
> 
> i found a script some where it starts with 
> function add(args)
>  temp=subwrd(args,1)
>  pr=subwrd(args,2)
> 
> i also want to ask what does "subwrd(args,1) command do in grads.
> 
> thanks

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20120926/986ee8e7/attachment-0003.html 


More information about the gradsusr mailing list