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 <emil.lenng...@gmail.com>wrote: > 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 = "a string" 'Line 5 > End > > Public Sub Main() > Dim i As Integer > For i = -1 To 0 > IIf(i, f1, f2)(1) > Next > End > > I get this message: MMain.f2.5: #6: Type mismatch: wanted Integer, got > String instead > Which is weird because isn't the a argument of type String? ;) > > /Emil > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user