[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Function calls



PureBytes Links

Trading Reference Links




Bill,
 
By using a Global variable in your function you can return 
multiple values. Here is an example from the AmiBroker user guide, VariableB is 
the global variable.
 

Example 2: Using local and global keywords to override 
default visibility rules:
VariableA = <FONT 
color=#ff00ff>5; // 
implict global variable 
function<FONT 
size=2> Test() { <FONT 
color=#800000>   local 
VariableA;  // explicit local variable with the 
same identifier as global <FONT 
size=2>   global<FONT 
color=#000000> VariableB; // explicit global variable 
not defined earlier 
<FONT 
color=#008000>                     // 
may be used to return more than one value from the function<FONT 
size=2>    VariableA = <FONT 
color=#ff00ff>99; 
   VariableB = <FONT 
color=#ff00ff>333; } 
VariableB = 1; 
// global variable<FONT 
color=#000000> "Before function 
call"; <FONT 
color=#ff00ff>"VariableA = " + 
VariableA; "VariableB = "<FONT 
size=2> + VariableB; Test(); <FONT 
color=#ff00ff>"After function call"<FONT 
color=#000000>; "VariableA = "<FONT 
color=#000000> + VariableA + " (not affected by 
function call )"; 
"VariableB = " + 
VariableB + " (affected by the function call 
)"
At the end of the function we can see 'return' statement that is 
used to return the result to the caller. Note that currently return statement 
must be placed at the very end of the function.
It is also possible to write a procedure (a function that 
returns nothing (void))

Regards,William 
Peterswww.amitools.com-----Original Message-----From: 
BillBarack [<A 
href="">mailto:wbarack@xxxxxxxxxxx]Sent: 
Friday December 26, 2003 12:13 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: 
[amibroker] Function callsCan a function call return multiple 
variables? If so, can anyone postthe syntax for this.All the 
examples I have seen return only one variable.Thanks and Happy New 
Year,BillSend BUG REPORTS to bugs@xxxxxxxxxxxxxSend 
SUGGESTIONS to 
suggest@xxxxxxxxxxxxx-----------------------------------------Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx(Web page: <A 
href="" 
target=_blank>http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
group FAQ at: <A 
href="" 
target=_blank>http://groups.yahoo.com/group/amibroker/files/groupfaq.htmlYahoo! 
Groups LinksTo visit your group on the web, go to: <A 
href="" 
target=_blank>http://groups.yahoo.com/group/amibroker/To unsubscribe 
from this group, send an email 
to: amibroker-unsubscribe@xxxxxxxxxxxxxxxYour use of Yahoo! 
Groups is subject to: <A href="" 
target=_blank>http://docs.yahoo.com/info/terms/


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 









Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.