Very minor error message:
Debug a=a+1 reports:
Line 14: Comparisons (=, <, >, =< and >=) are only supported with keywords like If, While, Until or within Bool().
However, a=a+1 in this case isn't a comparison but an evaluation / assignment
(I just can imagine you will ignore this one )
Incorrect error message on Debug a = a+1
Incorrect error message on Debug a = a+1
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: Incorrect error message on Debug a = a+1
The error reported as 'Comparisons (=, <, >, =< and >=) are only supported with keywords like If, While, Until or within Bool().' makes sense when the code be interpreted like this (imaginary parenthesis added to emphasize interpretation):
Assignment is a statement and not an operator and so can't be included in any other statements or expressions, including debug statements (I am ignoring the syntactic sugar that combines assignment along with a math operator, i.e. a + 1 for a = a + 1). So it does not seem to be necessary to guard against it in the list of errors generated for other statements, IMHO.
I don't think there is a problem with the way it currently is. What would you suggest the error mesage say instead?
Code: Select all
Debug (a=a)+1
I don't think there is a problem with the way it currently is. What would you suggest the error mesage say instead?
Re: Incorrect error message on Debug a = a+1
That's correct, but in connection with Debug the whole a=a+1 is a rhs term and so the '=' can only be interpreted as a comparsion sign. No bug.blueznl wrote:However, a=a+1 in this case isn't a comparison but an evaluation / assignment
sorry for my bad english
-
- Addict
- Posts: 4527
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Incorrect error message on Debug a = a+1
That's right.Josh wrote:in connection with Debug the whole a=a+1 is a rhs term and so the '=' can only be interpreted as a comparsion sign. No bug.
If a should be incremented by 1, and then the value of a should be shown, it must read like this:
Code: Select all
a = a + 1 ; or just a + 1
Debug a
Re: Incorrect error message on Debug a = a+1
As I said, it is not important
I just accidentally entered a 'Debug' in the wrong line of code, so (just an example below!)
became
So you can see how my PERCEPTION (cheap cop-out, I know) was it was an assignment.
I just accidentally entered a 'Debug' in the wrong line of code, so (just an example below!)
Code: Select all
a = 5
a = a+1
If a > 10
Code: Select all
a = 5
Debug a = a+1
If a > 10
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: Incorrect error message on Debug a = a+1
blueznl, your Survival Guide has this very example in it, here:
http://ninelizards.com/purebasic/pureba ... bug_output
But your explanation of it says that "Debug a = a+1" always outputs 1, instead of saying it raises a Bool() error.
You can see this just above the "11.5 Variable Viewer" heading. FYI.
http://ninelizards.com/purebasic/pureba ... bug_output
But your explanation of it says that "Debug a = a+1" always outputs 1, instead of saying it raises a Bool() error.
You can see this just above the "11.5 Variable Viewer" heading. FYI.
Re: Incorrect error message on Debug a = a+1
Another part that needs a rewrite... The guide is beginning to age...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )