Page 1 of 1

[ LTS 5.73 X64 Win 10] #PI give a syntax error

Posted: Thu Apr 14, 2022 11:19 am
by bfernhout
I try to use the constant #PI but the compiler rejects this. By giving a syntax error

Code: Select all

#PI
Then i did somthing realy weerd. And give the constant an value.

Code: Select all

#PI = 3.14
This is also rejected by saying Constant already declared.
Is this a real bug or is there somthing wrong here

// Moved from "Bugs - Windows" to "Coding Questions" (Kiffi)

Re: [ LTS 5.73 X64 Win 10] #PI give a syntax error

Posted: Thu Apr 14, 2022 11:29 am
by BarryG
Not a bug. #PI is a built-in constant that is already defined, so you can't (or need to) re-define it:

Code: Select all

Debug #PI ; Shows 3.1415926535897931

Re: [ LTS 5.73 X64 Win 10] #PI give a syntax error

Posted: Thu Apr 14, 2022 5:26 pm
by Olli
Normally, only #PI like this :

Code: Select all

#PI
should cause an error. Did you test simply this ?

Code: Select all

Debug #PI

Re: [ LTS 5.73 X64 Win 10] #PI give a syntax error

Posted: Thu Apr 14, 2022 8:43 pm
by mk-soft
#PI is a constant.

Writing only #PI is of course a syntax error. Writing only 100 is also only a syntax error. Where is the problem

Code: Select all

Debug #PI
dblVal.d = #PI
Debug dblval

Re: [ LTS 5.73 X64 Win 10] #PI give a syntax error

Posted: Sun Apr 17, 2022 6:47 pm
by bfernhout
I did read the documentation on the wrong way. That is becaus i am dyslexis. That give me sometime the wrong impression. After carefully checking and reading the reply i figure it out.

The Constant is already defined. So when i redefine the constant i got a error. When ik defining e.g. #PI its a error cause its already declare with 3.14.... So when i use the #PI the number as a defined constant its working. And i do not need to defining it again.

Thanks for the reply people. Many thanks for the help.