How would I write code to return the number 4 given x=28? Or alternatively if x=16 then I would return 2. I also need to return the higher number if x falls in between two numbers. The only way solution I can think of is to use if statements, but I will have about a dozen numbers in the hash and writing if statements would take a while.$num{'15'}=1; $num{'20'}=2; $num{'25'}=3; $num{'30'}=4; $x=28;
In reply to List of Numbers by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |