Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: Number Based Priority System

1. ## Number Based Priority System

Hello,

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"

• Ummm...

Code:
```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.

• ## Users who have thanked Old Pedant for this post:

jason_kelly (07-11-2012)

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•