Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: javascript var if

  1. #1
    Junior Member ripley_2092's Avatar
    Join Date
    Mar 2018
    Location
    south africa
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question javascript var if

    hey guys, need some help.

    I have the following

    ================
    var countrycode="ZA"
    //Rate per km (number)
    var rateperkm=20;
    //Minimum fare (number)

    var minimum_distance=30;
    //LESS THEN ZAR250//

    var minimum_fare=250;
    //Currrency Symbol
    var currencysymbol="ZAR";
    //Avoid motorways / highways? true/false
    var avoidHighways=false;
    //Avoid toll roads? true/false
    var avoidTolls=false;
    //Show summary? true/false
    var showsummary=false;
    //Show Route Map
    var showroutemap=true;
    //Disclaimer text
    =======

    how do I add a "var if" to the minimum distance?

    I tried this -> if (minimum_distance >400) rateperkm=10; {}

    which says if kms is greater then 400km then charge 10, instead of 20.

    but it doesnt work.

    any help would be appreciated.
    Life is pleasant. Death is peaceful. It's the transition that's troublesome.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: javascript var if

    Javascript is not the same as java.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. [SOLVED] Cannot declare an array var within a class
    By summit45 in forum Object Oriented Programming
    Replies: 2
    Last Post: July 29th, 2013, 10:59 PM
  2. Var Might have been initialize
    By Evilreaper in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 15th, 2012, 10:27 AM
  3. What is sql:query var refers to and what's wrong with the below code ?
    By tangara in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: October 8th, 2011, 05:24 AM
  4. [SOLVED] increase while loop && var
    By Scotty in forum Java Theory & Questions
    Replies: 11
    Last Post: December 9th, 2010, 02:32 PM