in reply to Re^5: alternatives to if and series of elsif
in thread alternatives to if and series of elsif

Thanks, gsiems!

I did a lazy test prior to your posting above on my while version and, as shown by your automated test, it didn't produce the expected results. The base_points are incremented as long as the condition is true and are returned regardless of the status of the final test, which is the crucial one.

I like your ternary version because it's relatively easy to understand. It also tends to be faster as the points go up.

  • Comment on Re^6: alternatives to if and series of elsif