4 variables, 1 outcome

Hi everyone,

I'm looking for suggestions about how best to do the following in a neat and tidy way!

I have 4 variables that can be 0, 2, 3 or 5.
There are 16 combinations that I'm interested in.

What I'd like to be able to do is call a function with the with variables and for it to return the corresponding combination number.

Clear as mud? I thought so! ;D

I can do it using 16 if statements but someone must have a neater way of doing it!

Thanks, Easty.

How about something like:

switch(1000*v1+100*v2+10*v3+v4)
{
  case 5320: ... ; break;
  case 2555: ... ; break;
  case 3232: ... ; break;
  .
  .
  .
}

?

Mikal

I like it!

Thanks!