Since this exercise was too simplistic I decided to do it in GolfScript
You can call it like this (with 0 being false and 1 being true):
1000 0 bonus
1000 1 bonus
The "function body":
In a more traditional stack-based language like Forth one could define the word bonus simply as :
: bonus if 10 * . else . then ;
1000 true bonus
Obtuse, but fun!
That’s a pretty apt summary of GolfScript. I like it for solving small problems like this, fun mental exercise.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.