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

Re: About Highest_a function?



PureBytes Links

Trading Reference Links

Phillipe,

The code uses the else statement if Array size = 1 or less, not 0 or  less.  The
Array always has at least one element (HiHi).

Bill Amend



Philippe Lhermie wrote:

> Hi folks,
>
> Highest_a returns the Highest value within an Array of values.
> Does anyone understand the reason why there is an else statment when
> Array_size is equal to 0 or a negative value?
> In fact, I find strange that an array can have a negative number of
> elements!
> What do you think of this?
>
> In reality, Array_size reprents the number of elements for which we want
> to know the highest one.
> Array_size can be inferior or equal to the number of elements that the Array
> contains.
>
> Here is the code below
> ************************************************************************}
>
> Inputs: HighestArray[size](NumericArrayRef), Array_Size(Numeric);
> Variables: HiHi(0);
> {Array_Size is passed as an Input so that only the array elements that have
> been used are referenced}
>
> HiHi = HighestArray[1];
>
> For value1 = 1 To Array_Size Begin
>         If HighestArray[value1] > HiHi Then
>                 HiHi = HighestArray[value1];
> End;
>
> If Array_Size > 1 Then
>         Highest_a = HiHi
> Else
>         Highest_a = HighestArray[Array_Size];
>
> Many thanks for your help !
> Rgds,
>
> Philippe
>
> °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
> philippe.lhermie@xxxxxxx
>
> °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°