[Gambas-user] little problem here...

Benoit Minisini gambas at ...1...
Sun Dec 11 01:17:54 CET 2005


On Saturday 10 December 2005 20:44, Stefano Palmeri wrote:
> Hi all. Hi Benoit.
>
> I'm porting a gambas1 project to gambas2 and I noticed a strange thing.
>
> In Gambas1 the command:
>
> PRINT 1 + 1 & " = 1 + 1"
>
> returns
>
> 2 = 1 + 1
>
> In Gambas2 the same instruction returns
>
> 2
>
> The second part of the string is missing...
>
> But if I put "1 + 1" beetwen round brackets it works fine.
>
> PRINT (1 + 1) & " = 1 + 1" returns
>
> 2 = 1 + 1
>
> Please, I would like to know whether this is a new rule
> of Gambas2, (because I've a plenty of these strings to fix...)
> or a temporary bug (some kind of relation to new C-style assignment
> operators?).
>
> Regards,
>
> Stefano Palmeri
>
> P.S. My Gambas2 version is 1.9.20
>

There were changes in operators priority in the development version. Now '&' 
is always applied before '+', whereas it was ambiguous in the stable version.

So you have to use braces like you did when porting your code.

Sorry for the inconvenience!

Anyway, it was a very bad idea to write something like '1 + 1 & " = 1 + 1"'.

Regards,

-- 
Benoit Minisini





More information about the User mailing list