PDA

View Full Version : How to get a minimum rate


Linda
11-21-2002, 06:21 PM
Hi!

I am trying to create a "if" so that if a number is less that, lets say, 30, it will give 30.


My guess (I can't get it to work and I don't know whether to put it into another "if" or if it can work alone outside.)

if (finalprice < 30) finalprice = 30


Thanks!
Linda :rolleyes:

beetle
11-21-2002, 06:45 PM
Looks fine to me. Are you sure finalprice is a valid number (i.e. NOT a string) ??

if (parseInt(finalprice, 10) < 30) finalprice = 30;

or

if (parseFloat(finalprice) < 30) finalprice = 30;

beetle
11-21-2002, 07:39 PM
Immediately below this lineiTotalPressupost = Math.round (iPreuParaula * iNumeroParaules);addif (iTotalPressupost < 30) iTotalPressupost = 30;