[Clip] Re: Why does a neg value cause a syntax error in calc?
- --- In email@example.com, loro <tabbie@...> wrote:
> joy8388608 wrote:
> >; Syntax error when first var is not initialized and second is negative
> >^!Set %JobAmt%=-10
> >^!Set %Temp4%=^$Calc(^%Cash16P% + ^%JobAmt%)$
> Joy, I know this is old, but I was skimming through old post and
> started to play with this again and I discovered something useful.
> It's only when the negative number is the first to be added to the
> not initiated variable the problem occurs.
> Try this.
> ^!Info ^$Calc(^%blah%+0+-5)$
> ===> -5
> So if you always add zero first, I think it should work.
Thanks for going back and giving it more thought. I have, of course, already found a workaround, but this is a simpler and better one then I have and I will remember this technique for the future as will others.