Singh wrote:
Hello,

        I have the following code :

        Sub A
                ...
                Dim I As Integer
                Dim EO1 As Boolean
                ...

                For I = 1 To 100
                        EO1=EvenorOdd(I)
                        ...
                Next I
                ...
        End Sub

        Function EvenorOdd(Number1 As Integer)
                Dim EvenorOdd As Boolean
                Dim mod1 As Integer
                If Number1=0 Then
                        EvenorOdd=True
                ElseIf Number1=1 Then
                        EvenorOdd=False
                Else
                        mod1= Number1 MOD 2
                        EvenorOdd=CBool(1-mod1)
                End If
        End Function

        Needless to add, EvenorOdd is superfluous - simply EO1=CBool(1-(I MOD 
2))
instead of the function invocation would do the trick. However, I am facing
a problem in assigning the results of the function invocation.

        EO1 remains stubbornly False (which it is initialized to by default)
regardless of the return value of the Function above. Any ideas why
something like this might happen with this code fragment ?

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Singh

If you remove the "Dim EvenorOdd as Boolean" from the function it will work properly. Just for convention I also made the following change: "Function EvenorOdd(Number1 as Integer) as Boolean".


TomW

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to