[Gambas-user] Why syntax error?

Rolf-Werner Eilert eilert-sprachen at ...221...
Thu Aug 13 18:09:46 CEST 2015



Am 13.08.2015 16:06, schrieb Adrien Prokopowicz:
> Le Thu, 13 Aug 2015 12:05:06 +0200, Adrien Prokopowicz
> <adrien.prokopowicz at ...626...> a écrit:
>
>> 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,

Thank you very much for the explanation!

>>
>
> The error messages are much more clear now in revision #7222 !
>

Oh - I'm working with the last official version on this machine. But 
looking forward to see it soon :)

Rolf




More information about the User mailing list