hundreds of if/then/else/endif?

1. Toni Guest

## hundreds of if/then/else/endif?

Hello all,<BR>I have to write a script that will take 2 variables from a user form and look up a 3rd variable from an array. To those who dive, this would be depth & time returning the residual niitrogen level (A "K" diver"<BR>Now, is there any way to write this simpler than:<BR>if depth=&#060;20 & time =&#060; 10 then <BR>response.write "You are a K diver" else<BR>if depth =&#060;30 & time =&#060; 20 then<BR>response.write "You are a D diver" etc, etc, etc. (this is a loosely put together code... but you get the logic)<BR>there simply has to be a better way....

2. Senior Member
Join Date
Dec 1969
Posts
19,082

## RE: hundreds of if/then/else/endif?

stick &#039em in an ASP database and use a single dynamic SQL statement<BR><BR>jason

3. MBrooker Guest

## Good Ol' Fashion Math

When you have a large list of variables like that, there is usually a Math formula behind it. This one sounds like a differential rate problem. Either look at the data and find the pattern or find an equation on the subject. You can always do it the slacker&#039s way and put it in a database, but you&#039ll never have quality code!

4. Toni Guest

## RE: Good Ol' Fashion Math

At this point, the slacker&#039s way is ok with me considering the equations/pattern is based on physiological experimentation and stuff that I really don&#039t want to learn.<BR>As far as the SQL stuff goes... is there another way (I humbly admit that I don&#039t know SQL.... it&#039s on my list... seems I just can&#039t get around it)

#### Posting Permissions

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