PureBytes Links
Trading Reference Links
|
William,
I saw that example but didn't know how to interpret it. Let me make a
guess at an interpretation and please correct me if I'm wrong.
1) There is no "Return" statement in the Function definition.
2) I use the "Return" statement to get a single variable:
x = "FunctionName"(arguements);
Now x is defined.
3) If I declare Global variables, they can be recalculated in the
function statements and they automatically are returned to the main
program at their recalculated values.
4) To return values, I don't have to have a statement like:
x = Test(VariableA, VariableB, etc.);
I can just use: "Test();" To call the function.
Thanks,
Bill
--- In amibroker@xxxxxxxxxxxxxxx, "William Peters"
<williampeters@xxxx> wrote:
> 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 = 5; // implict global variable
>
> function Test()
> {
> local VariableA; // explicit local variable with the same
identifier as
> global
> global VariableB; // explicit global variable not defined earlier
> // may be used to return more than one value
from the
> function
>
> VariableA = 99;
> VariableB = 333;
> }
>
> VariableB = 1; // global variable
>
> "Before function call";
> "VariableA = " + VariableA;
> "VariableB = " + VariableB;
>
> Test();
>
> "After function call";
> "VariableA = " + 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 Peters
> www.amitools.com
>
>
>
> -----Original Message-----
> From: BillBarack [mailto:wbarack@x...]
> Sent: Friday December 26, 2003 12:13 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Function calls
>
>
> Can a function call return multiple variables? If so, can anyone
post
> the syntax for this.
>
> All the examples I have seen return only one variable.
>
> Thanks and Happy New Year,
>
> Bill
>
>
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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 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:
> 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 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:
http://docs.yahoo.com/info/terms/
|