# Conditional variable quandary

**URL:** https://forum.kirupa.com/t/conditional-variable-quandary/203622
**Category:** flash
**Created:** [October 12, 2006, 3:48pm UTC](https://forum.kirupa.com/t/conditional-variable-quandary/203622 "2006-10-12T15:48:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![goffik](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@goffik](https://forum.kirupa.com/u/goffik)
#### Post date: [October 12, 2006, 3:48pm UTC](https://forum.kirupa.com/t/conditional-variable-quandary/203622/1 "2006-10-12T15:48:28Z")

</div>

Hi folks

A friend was asked to create a calculator which adds several variables together and produces an output which has other pre-determined variables added or subtracted…

The code for the above, which works fine, is as follows:[INDENT][FONT=Courier New]stop();  
function onCalculate() {

seventeen = Number(number\_seventeen);  
eighteen = Number(number\_eighteen);  
nineteen = Number(number\_nineteen);  
twenty = Number(number\_twenty);  
twentyone = Number(number\_twentyone);  
twentytwo = Number(number\_twentytwo);  
result\_amount = seventeen + eighteen + nineteen + twenty + twentyone + twentytwo;  
assets\_liabilities = result\_sum - result\_amount;  
net\_estate = assets\_liabilities - nil\_rateband;  
tax\_liability = 40 / 100 \* net\_estate  
}[/FONT]

[/INDENT]The problem now is that the people that asked for it forgot to say they needed a further calculation which between us we just can’t work out!

Basically, if [FONT=Courier New]net\_estate[/FONT] is _under_ 285000, then [FONT=Courier New]tax\_liability[/FONT] is to be 0. but if it’s \*over \*285000 then [FONT=Courier New]tax\_liability = 40 / 100 \* net\_estate [/FONT][FONT=Verdana](as in the above code).[/FONT]

We both thought it looked simple enough but can’t get our little heads round it - can anybody please help? It’s driving us mad!!! :crazy:

Thank you  
G
