in reply to Optimization of a piece of code(Is there a better way than this?)

One thing that nobody else has mentioned: the first if clause can be replaced with $Max_Questions ||= $Total_Questions. (Note, though, that this has different behavor then your code when $Max_Questions is defined, but false ("0" or ""). Your code will fall through to $Max_Questions<1, mine will use $Total_Questions instead.)


We are using here a powerful strategy of synthesis: wishful thinking. -- The Wizard Book

  • Comment on Re: Optimization of a piece of code(Is there a better way than this?)