/    Sign up×
Community /Pin to ProfileBookmark

If Statement

Hi

Below is code that I’m trying to use to set a variable depending on the value in another variable. for some reason it not working. it not subtracting the amount indeicated

I hope that what did can be followed

[code]

var convlandtax;

if (convPurchasePrice <=55000){
var convlandtax = ((convPurchasePrice)*0.005);
}

if (convPurchasePrice <=250000){
var convlandtax = (((convPurchasePrice) *0.01)-250);
}
if (convPurchasePrice <=400000){
var convlandtax = (((convPurchasePrice) *0.015)-1525);
}

if (convPurchasePrice >=400000){
var convlandtax =(((convPurchasePrice) *0.02)-3525);
}
[/code]

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceApr 06.2006 — <i>
</i>var convlandtax;

if (convPurchasePrice &lt;=55000){
var convlandtax = ((convPurchasePrice)*0.005);
}
else if (convPurchasePrice &lt;=250000){
var convlandtax = (((convPurchasePrice) *0.01)-250);
}
else if (convPurchasePrice &lt;=400000){
var convlandtax = (((convPurchasePrice) *0.015)-1525);
}
else if (convPurchasePrice &gt;=400000){
var convlandtax =(((convPurchasePrice) *0.02)-3525);
}
Copy linkTweet thisAlerts:
@UltimaterApr 06.2006 — Omit each instance of "var" expect for "var convlandtax;".
Copy linkTweet thisAlerts:
@phpnoviceApr 06.2006 — Yeah, that, too -- but keep the "else"s.
Copy linkTweet thisAlerts:
@AltF4Apr 06.2006 — What php novice said
Copy linkTweet thisAlerts:
@phpnoviceApr 06.2006 — What php novice said[/QUOTE]
Don't create a lot of posts devoid of real content -- where other people have already answered. If you want to say something, then say something that can be considered a true contribution. Thanks. :mad:
×

Success!

Help @kproc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...