Re: [Gambas-user] IIf syntax

2012-03-16 Thread Jussi Lahtinen
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

Re: [Gambas-user] IIf syntax

2012-03-16 Thread Emil Lenngren
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...

Re: [Gambas-user] IIf syntax

2012-03-16 Thread 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... > > I think it is not really meant that you should be able to pass functions > > into IIf... >

Re: [Gambas-user] IIf syntax

2012-03-16 Thread Emil Lenngren
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 >

Re: [Gambas-user] IIf syntax

2012-03-16 Thread 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 > In revision #4557, I have forbidden the use of Class or

Re: [Gambas-user] IIf syntax

2012-03-16 Thread Emil Lenngren
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

Re: [Gambas-user] IIf syntax

2012-03-16 Thread Randall Morgan
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

Re: [Gambas-user] IIf syntax

2012-03-16 Thread Emil Lenngren
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:

Re: [Gambas-user] IIf syntax

2012-03-16 Thread 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: > Hi. I wonder if this syntax is intended to be allowed ;) > > Public Function f1() > Print "f1!"

[Gambas-user] IIf syntax

2012-03-16 Thread Emil Lenngren
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