...

View Full Version : Number Based Priority System



jason_kelly
07-11-2012, 02:41 AM
Hello,

I need your help.

How can I go about creating a priority system based on a given number

ex.

var n = 5
var p = priority level

If n is between 0 and 5 then p = "high"

If n is between 5 and 10 then p = "medium"

If n is between 10 and up then p = "low"

Old Pedant
07-11-2012, 02:48 AM
Ummm...



var p;
if ( n < 0 ) { p = "invalid"; }
else if ( n <= 5 ) { p = "high"; }
else if ( n <= 10 ) { p = "medium" }
else { p = "low"; }

Did you really mean something that simple??? Or are you asking something completely different?

If you prefer, you can change the <='s there to just <.

As you wrote your message, exactly 5 might be either "high" or "medium", for example. So you choose.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum