Not me, M$ did
It is directly copied from MSDN Help...
/Henning
"Saga" skrev i meddelandet @TK2MSFTNGP02.phx.gbl...
> As some one else said, I think you missed some code there because that
> function as is given, is equivalent to:
>
> Function BinarySearch(. . .) As Boolean
>
> End Function
>
> (I am sure that that example is missing substantial code
>
> Saga
> --
>
>
>
> "Henning" wrote in message
> $0$93305$57c3e1d3@news3.bahnhof.se...
>> Sorry about this all, if I weren't so lazy I could have searched MSDN
>> first. Now I did.
>>
>> If no value is assigned to name, the procedure returns a default value: a
>> numeric function returns 0, a string function returns a zero-length
>> string (""), and a Variant function returnsEmpty. A function that returns
>> an object reference returns Nothing if no object reference is assigned to
>> name (using Set) within the Function.
>> The following example shows how to assign a return value to a function
>> named BinarySearch. In this case, False is assigned to the name to
>> indicate that some value was not found.
>>
>> Function BinarySearch(. . .) As Boolean
>> . . .
>> ' Value not found. Return a value of False.
>> If lower > upper Then
>> BinarySearch = False
>> Exit Function
>> End If
>> . . .
>> End Function
>
>> /Henning"Saga" skrev i meddelandet
>> @TK2MSFTNGP02.phx.gbl...
>>>I say that it is not safe, given the info that you have provided.
>>>
>>> For example:
>>>
>>> Function IsShoe(nr As Integer) As Boolean
>>>
>>> if nr = 3 then
>>> IsShoe = true
>>> end if
>>>
>>> End Function
>>>
>>> Above the function result is set toTrue only if nr is 3 which means that
>>> is nr 3 then IsShoe is not initialized and is therefore assumed to be
>>> False, but...
>>>
>>> Function IsShoe(nr As Integer) As Boolean
>>>
>>>
>>> IsShoe = (nr = 3)
>>>
>>> End Function
>>>
>>> The above always sets IsShoe accordingly, but here again...
>>>
>>>
>>> Function IsShoe(nr As Integer) As Boolean
>>>
>>>
>>> IsShoe = true
>>>
>>> if nr = 3 then
>>> IsShoe = false
>>> end if
>>>
>>> End Function
>>>
>>> The above, by default sets IsShoe to True and only sets it to False if
>>> nr is 3.
>>> (No relation to the first two)
>>>
>>> Unless you know how the function behaves, I would say it is not safe to
>>> assume any
>>> kind of default value.
>>>
>>> Regards,
>>> Saga
>>> --
>>>
>>>
>>> "Henning" wrote in message
>>> $0$93305$57c3e1d3@news3.bahnhof.se...
>>>> Hi grp,
>>>>
>>>> Is it safe to assume the default for the following is always False?
>>>> Function IsShoe(nr As Integer) As Boolean
>>>>
>>>> /Henning
>>>>
>>>
>>>
>>
>>
>
>
Archived from group: microsoft>public>vb>general>discussion