Of course this works. arg is an array. arg[0], arg[1],
etc. are scalars (numbers).
You can stuff an array and then cherry-pick numbers from it, no problem. One
thing to keep in mind though is that if you are using an index to do your
cherry picking, (e.g. arg[ndx] ) the index needs to be always defined at the
point you are using it.
Further, if you are looping over that index, then within the loop all the
unadorned array names you use will be expected to have subscripts. IOW, you
can't write "naked" array code inside a for loop (though you can pass
arrays to functions and get them back).
The way I've come to look at it is that when I have a loop in my code( any
loop, not just a 0 -> (BarCount - 1) loop ), I am in a "loop
environment" for the duration of the loop, and must alter my authorship
accordingly.
--- In amibroker@xxxxxxxxxps.com,
"reefbreak_sd" <reefbreak_sd@...> wrote:
>
> Not to beat this to death, but I have used
> arg[0] = 3.14159
> arg[1] = sqrt(2)
> arg[2] = 2.7182
> arg[3] = 1.61803
> to refer to numbers - not arrays. Then they will work in 'if' statements
like:
>
> if(arg[2] > arg[1])
> arg[4]=1;
> else
> arg[4]=0;
>
>
> ReefBreak
>
>
>
>
>
> --- In amibroker@xxxxxxxxxps.com,
"peter843" <yahoogroups@> wrote:
> >
> > I thought it over and I see now why it is good for 'iif' to return an
array.
> >
> > The 'selectedvalue' will take care of my needs.
> >
> > --- In amibroker@xxxxxxxxxps.com,
"peter843" <yahoogroups@> wrote:
> >
> > > What puzzles me is that "x = IIf( Close > Open, 1, 0
);" seems to create an array variable even though it is being assigned a 1
or 0.
> >
>