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 Step -1 IIf(i, f1, f2)(1) Next End On Fri, Mar 16, 2012 at 1:46 PM, Emil Lenngren <emil.lenng...@gmail.com>wrote: > What do you mean? None of f1 or f2 has a return type... > > /Emil > > 2012/3/16 Randall Morgan <rmorga...@gmail.com> > > > 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 > > > > ------------------------------------------------------------------------------ > 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