Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

WAD @EVAL

May
12,846
164
This is expected.
Code:
v:\> echo %@eval[(0 & 1) + 0]
0
This is not expected.
Code:
v:\> set n=0

v:\> echo %@eval[(%n & 1) + %n]
TCC: Divide by zero "(0 & 1) + %n"
 
I don't think you need the %'s inside of EVAL.
Code:
set n=0
echo %@eval[(n & 1) + n]
0
set n=1
echo %@eval[(n & 1) + n]
2
 
I don't think you need the %'s inside of EVAL.
Code:
set n=0
echo %@eval[(n & 1) + n]
0
set n=1
echo %@eval[(n & 1) + n]
2
I know. But I always use them anyway. I've never seen them hurt (before).
 
Last edited:
Scott is right - don't use % unless you are referencing an internal variables or function. In you example, part of the line is being expanded by the parser and part by @eval.
I have always used "%" and probably will continue. This problem is as old as the hills. The help could call some attention to it. How do you fix this one?
upload_2017-8-14_13-31-22.png

... a bunch of ways ...
upload_2017-8-14_13-32-49.png
 
Or you could put something prominently in @EVAL's help. That's the first place I went after getting unexpected behavior, and all l could find was
& same as AND
 
Back
Top