[Gambas-user] Why syntax error?

Adrien Prokopowicz adrien.prokopowicz at ...626...
Thu Aug 13 12:05:06 CEST 2015


Le Thu, 13 Aug 2015 11:19:09 +0200, Sprachschule Eilert  
<eilert-sprachen at ...221...> a écrit:

> This produces a syntax error, but it doesn't tell me why:
>
> Private Const $TB As String = Chr$(9)
>
> If I leave "Const" away, it runs, so it shouldn't be the $TB which
> disturbs, as it is accepted as a variable naming. The rest should be ok,
> too. So I can't find any reason...
>
> Thanks for any hint
>
> Rolf
>

This is because calling functions is not allowed when defining a constant
value.

In your case, you have to use a string containing your character using an
escape code :

	Private Const $TB As String = "\x09" 'Contains the ASCII character 9

Or, even better in your case :

	Private Const $TB As String = "\t" 'Contains the TAB character (ASCII 9)

But I agree that the error message is not very clear ...

Regards,

-- 
Adrien Prokopowicz




More information about the User mailing list