I ran into some $calc behaviour I find rather odd, and I was hoping someone here could explain why it happens. Usually when doing calculations I use $calc to avoid things being interpreted as text instead. Now consider this line:
var %change = $calc($2 - %bonus_ [ $+ [ $1 ] ])
$1 = str (the rest of the variable name I want to use..)
$2 = 0
%bonus_str = 4
%change becomes 0, while I was expecting 0 - 4 = -4
If I omit the $calc() part, %change is correctly assigned the value -4, but
why?
Explanation would be appreciated to prevent future potential bugs in my scripts