<HTML>
<HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="OPENWEBMAIL" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
Hi Farah,
<br />
<br />example:
<br />
<br />* Calling a function and passing 4 arguments in the main script:
<br />a=test(theta,pressure,u,v)
<br />
<br />Outside of the main script, you write a function, as the function "test" below:
<br />
<br />function test(args)
<br />PotTemp=subwrd(args,1)
<br />Press=subwrd(args,2)
<br />ZonalW=suvwrd(args,3)
<br />MeridW=subwrd(args,4)
<br />
<br />*Some calculation in the function
<br />
<br />a1=(ZonalW*ZonalW)+(MeridW*MeridW)
<br />
<br />return a1
<br />
<br />As a final result, a1 will be passed to the variable "a" in the main script.
<br />
<br />Hope this helps,
<br />Ricardo
<br />
<br /><font size="2"><b>On Wed, 26 Sep 2012 02:09:15 -0700, Farah Ikram wrote</b>
<br />> hi,
<br />>
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.
<br />>
<br />> i found a script some where it starts with
<br />>
function add(args)
<br />> temp=subwrd(args,1)
<br />>
pr=subwrd(args,2)
<br />>
<br />> i also want to ask what does
"subwrd(args,1) command do in grads.
<br />>
<br />>
thanks
<br />
<br />
<br />
</font>
</BODY>
</HTML>