[Gambas-user] Gambas scripting, Type mismatch error.

Bruce Steers bsteers4 at gmail.com
Tue Nov 17 19:03:18 CET 2020


Is this a bug in the scripter or bad coding technique on my part?...
getting a type mismatch error if i do not wrap variables in parentheses?
doesn't happen like this in normal gambas exe.

If I use code like the following in a gbs script...

Dim iVal As Integer = 1

Print iVal  ' This prints '1'

Print iVal + 1 ' this prints '2'

Print "Val = " & iVal  ' this prints 'Val = 1'

Print "Val = " & iVal + 1
' This gives the following error..
' MMain.?.0: #6: Type mismatch: wanted Float, got String instead

Print "Val = " & (iVal + 1)  ' this works and prints 'i = 2'

Cheers
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201117/9b2cb063/attachment.htm>


More information about the User mailing list