Mucho gracias! Problem got solved.
--
"Auric__" <not.my.real@[EMAIL PROTECTED]
> skrev i melding
news:471ce0b0$0$26461$88260bb3@[EMAIL PROTECTED]
> On Mon, 22 Oct 2007 16:59:24 GMT, Anonymous wrote:
>
>> Hello,
>>
>> In the code below the "BinarySearch" function returns 0, although
>> it is assigned a value of 8.
>> Anyone any idea?
>
> [snip]
>
>>IF Find = @[EMAIL PROTECTED]
THEN
>> PRINT m 'm has the correct value here(8),but the function returns 0
>> BinarySearch = m
>>ELSEIF Find < @[EMAIL PROTECTED]
THEN
>> BinarySearch i(),a,m,Find
>>ELSE
>> BinarySearch i(),m+1,b,Find
>>END IF
>
> [snip some more]
>
> You're recursing but not catching the return values from the
> recursion. Try something like this:
>
> IF Find = @[EMAIL PROTECTED]
THEN
> FUNCTION = m
> ELSEIF Find < @[EMAIL PROTECTED]
THEN
> FUNCTION = BinarySearch (i(),a,m,Find)
> ELSE
> FUNCTION = BinarySearch (i(),m+1,b,Find)
> END IF
>
> --
> auric dot auric at gmail dot com
> email sent to the above address is not treated as private
> *****
> Don't demand justice; you too will be judged.
>
> --
> Posted via a free Usenet account from http://www.teranews.com
>


|