EricE
New Member
Posts: 2
|
Post by EricE on Nov 14, 2020 9:32:16 GMT -5
Hello Liberty BASIC forum.
Why is it that using the Unary Negative Operator (-) will result in Liberty BASIC reporting a syntax error.
For example, this will cause an error.
a = 4 Print -a
While subtracting a from zero will run without error.
a = 4 Print 0-a
Is there a workaround to change the sign of a variable other than subtracting it from zero?
|
|
|
Post by tenochtitlanuk on Nov 14, 2020 9:52:21 GMT -5
Unary minus has long been a request. Using '0 -a' is the work-round
OR
Use the alpha releases of LB5 which handle unary minus.
a =-1 print a print -1 gives
-1 -1
|
|
EricE
New Member
Posts: 2
|
Post by EricE on Nov 14, 2020 10:04:17 GMT -5
Thank you tenochtitlanuk.
|
|