To clear out more...
This is allowed:
IIf(1 = 2, function1(arg), function2(arg))
And functions 1 and 2 can return integer, string, etc.
But this is *not* allowed:
IIf(1 = 2, function1, function2)
So, IIf cannot take pointer to function as argument.
Jussi
On Sat, Mar 17, 2012 at 00:12, Emi
They should work, since it is strings you are passing to IIf.
2012/3/16 Bruce Bruen
> On Fri, 2012-03-16 at 22:42 +0100, Benoît Minisini wrote:
> > Le 16/03/2012 22:21, Emil Lenngren a écrit :
> > > Yeah, I alreadyd did that ^^
> > > It says "a" is an integer even though it should be a string...
On Fri, 2012-03-16 at 22:42 +0100, Benoît Minisini wrote:
> Le 16/03/2012 22:21, Emil Lenngren a écrit :
> > Yeah, I alreadyd did that ^^
> > It says "a" is an integer even though it should be a string...
> > I think it is not really meant that you should be able to pass functions
> > into IIf...
>
Looks good :)
2012/3/16 Benoît Minisini
> Le 16/03/2012 22:21, Emil Lenngren a écrit :
> > Yeah, I alreadyd did that ^^
> > It says "a" is an integer even though it should be a string...
> > I think it is not really meant that you should be able to pass functions
> > into IIf...
> >
> > /Emil
>
Le 16/03/2012 22:21, Emil Lenngren a écrit :
> Yeah, I alreadyd did that ^^
> It says "a" is an integer even though it should be a string...
> I think it is not really meant that you should be able to pass functions
> into IIf...
>
> /Emil
>
In revision #4557, I have forbidden the use of Class or
Yeah, I alreadyd did that ^^
It says "a" is an integer even though it should be a string...
I think it is not really meant that you should be able to pass functions
into IIf...
/Emil
2012/3/16 Randall Morgan
> Sorry, I misunderstood where your error was.
>
> But try this, you may find the resul
Sorry, I misunderstood where your error was.
But try this, you may find the results interesting
Public Function f1(a As Integer)
Print a; TypeOf(a)
End
Public Function f2(a As String)
a = "a string" 'Line 5
Print a; TypeOf(a)
End
Public Sub Main()
Dim i As Integer
For i = 0 To -1
What do you mean? None of f1 or f2 has a return type...
/Emil
2012/3/16 Randall Morgan
> I suspect that since you are declaring a return type on your functions that
> the functions default to an integer return type. Try it and see...
>
> On Fri, Mar 16, 2012 at 11:20 AM, Emil Lenngren >wrote:
I suspect that since you are declaring a return type on your functions that
the functions default to an integer return type. Try it and see...
On Fri, Mar 16, 2012 at 11:20 AM, Emil Lenngren wrote:
> Hi. I wonder if this syntax is intended to be allowed ;)
>
> Public Function f1()
> Print "f1!"
Hi. I wonder if this syntax is intended to be allowed ;)
Public Function f1()
Print "f1!"
End
Public Function f2()
Print "f2!"
End
Public Sub Main()
IIf(True, f1, f2)()
End
It prints out "f1!" ...
But in this code:
Public Function f1(a As Integer)
End
Public Function f2(a As String)
a
10 matches
Mail list logo