Something wrong in Compiler?

General discussion on mikroPascal PRO for ARM.
Post Reply
Author
Message
corado
Posts: 399
Joined: 28 Mar 2009 11:03

Something wrong in Compiler?

#1 Post by corado » 30 Sep 2023 20:52

This doesn't work

Code: Select all

Program Test;

CONST a : Byte = 100;

Begin
a := 1;
end.
Error Message: 35 325 Constant cannot be assigned to LedBlinking.mpas

But normaly this work in Turo oder FreePascal. Typed Const
Last edited by corado on 11 Oct 2023 16:33, edited 1 time in total.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Something wrong in Compiler?

#2 Post by filip » 11 Oct 2023 14:45

Hi,

The identifier 'a' was declared as constant, therefore its value cannot be changed in the runtime only at the declaration.

Regards,
Filip.

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: Something wrong in Compiler?

#3 Post by corado » 11 Oct 2023 16:34

But it's an Typed constant, not an normal constant.
This normaly work in Pascal:-)
https://stackoverflow.com/questions/324 ... -constants

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Something wrong in Compiler?

#4 Post by filip » 12 Oct 2023 07:44

Hi,

OK, I understand this, but obviously our implementation of Pascal language differs from the FreePascal's in terms of constants.

Please refer to the Constants section in the Help file and const type qualifier for more information.

Regards,
Filip.

Post Reply

Return to “mikroPascal PRO for ARM General”