What am I doing wrong here?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Here's a few simple commands with their outputs:
[Z:\Work]Echo "%Description"
"abc def  ("

[Z:\Work]Echo "%Amount"

[Z:\Work]Echo Iff %@Right[1,%Description] %@Right[1,%Amount]
Iff ( %@Right[1,%Amount]

[Z:\Work]Echo Iff %@Right[1,%Amount]
Iff )
Hopefully it is obvious that the output of the second to last command is not what I would expect. Does the open parenthesis have anything to do with it?
I dunno. But here (first example below) it is boiled down a bit. It evaluates and echoes the first arg "( " correctly and doesn't seem to evaluate the second arg. The second example below shows that an unmatched parenthesis inside a function is not always a problem.

v:\> echo %@right[1,(] %@right[1,z]
( %@right[1,z]

v:\> echo %@len[(] %@right[1,)]
1 )