[Gambas-user] Numeric operation between strings.

user demosthenesk at ...626...
Mon Nov 8 12:49:20 CET 2010


ok i see that it works like this.

I just want to ensure how it works because i am writing a book about
Gambas and i want to describe some things correctly.

Thanks.

On Mon, 2010-11-08 at 11:52 +0100, Doriano Blengino wrote:
> user ha scritto:
> > ok i see this but
> >
> > CStr(-19776) output is it a string?
> >
> > for example i think there is difference between
> >
> > DIM sVar1="-19776" AS String
> > DIM iVar2=-19776 AS Integer
> >
> > why Gambas re-convert a string to integer again when see a + operator?
> >    
> Because gambas has automatic type conversion. So, if it sees a "+" 
> operator, which applies to numbers, it tries to convert its arguments to 
> integer (or even float?). I think that this feature, if used with a 
> grain of salt, can be very handy. When misused (I am not saying you were 
> misusing), it can lead to very surprising results. Use the "&" operator, 
> and the result will be no more strange.
> 
> Hope it helps, regards,
> Doriano
> 
> 
> 
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a 
> Billion" shares his insights and actions to help propel your 
> business during the next growth cycle. Listen Now!
> http://p.sf.net/sfu/SAP-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user






More information about the User mailing list