Copy link to clipboard
Copied
Hi,
I'm seeing code like this.
<cfset variables.AltTotalPrice = -(-Val(Order.TotalPrice) - Val(variables.TotalAltAmountRemaining))>
What does "(-Val(Order.TotalPrice)" do?
I created a simple test and it seems it is just returning negative values.
Can someone shed light why does a previous developer doing this?
Thanks.
Copy link to clipboard
Copied
this one adds up totalprice and totalaltamountremaining that it doesn't seem to subtract base on the cfset below.
<cfset TotalPrice = 90 />
<cfset TotalAltAmountRemaining = 80 />
<cfset t = TotalPrice - -Val(TotalAltAmountRemaining)>
<cfdump var="#t#">
strange formula that I can't answer why this adds up. any idea?
Copy link to clipboard
Copied
matt_xtr,
it is simple math really. think of :
TotalPrice - -Val(TotalAltAmountRemaining)
as :
90 - (-80)
I can't really speak to why the developer wrote it that way.