[Gambas-user] Wrong error message

Jussi Lahtinen jussi.lahtinen at ...626...
Tue May 4 18:11:56 CEST 2010


> Ok, now I understand the two code snippets above. The net result should
> be an integer having value 9876543210. Apart from the fact that a simple
> assignment does the same work, which leads me to think that Jussi wanted
> something else, I am still not convinced about the casting (or, better,
> conversion) while writing to variables.

 It was not part of my actual code, it was result of problem isolation for
 demonstration purpose.


> I feel something weird in using an integer variable as if it was a
> string, and the above snippet does that.

 As I said earlier, it is sometimes useful. Datatype is integer because
 all other usage of that variable is mundane math.
 But of course there are many other ways to do same thing.
 Example;
 n += i * exp10(i)
 Or using temporarily string variable for concatenate and then convert
back to integer.
 But I'm accustomed to use most simplest expression n &= i.

 BTW. 5*exp10(5) gives 500000.000000001 weird?
 Gambas 3 rev 2879 @ Ubuntu 10.04 64bit


Jussi




More information about the User mailing list