[Gambas-user] Wrong error message

Jussi Lahtinen jussi.lahtinen at ...626...
Mon May 3 21:39:52 CEST 2010


> For information, the previous code is equivalent to:
>
> Dim ii As Integer
> Dim jj As Integer
>
> For ii = 9 To 0 Step -1
>  jj = CInt(CStr(jj) & CStr(ii))
> Next

 Yes, exactly.
 Sometimes it is convenient to "add" numbers this way.
 I just didn't see the trouble to write conversion functions CInt and CStr.


> The error message comes from CInt(). When its argument cannot be converted to
> an integer, it just says that there is a type mismatch (you forgot to tell
> that) and that its argument is not an integer.

 I didn't understand why I got error message "Type mismatch: Wanted
Integer got String instead.",
 because I was using only Integer variables. Also error was unexpected as I
 didn't guess overflow to be possible... my bad. Basically error
message confused me more.

 I think better error message would be "Overflow" or "Internal
conversion error to Integer value",
 but as I said this is just minor bug.

Jussi




More information about the User mailing list