From: "Jesús Gabriel y Galán" Date: 2007-10-01T02:29:05+09:00 Subject: Re: [QUIZ] Probable Iterations (#141) On 9/30/07, Morton Goldberg wrote: > On Sep 30, 2007, at 9:32 AM, Jes�s Gabriel y Gal�n wrote: > > > $compare_types = {"at_least" => :>=, "exactly" => :==, > > "no_more_than" => :<=, > > "more_than" => :>, "less_than" => :<} > > > > > My question about main is the following: if you check my code, I have > > a variable ($compare_types) I need to use both in the validate block > > for an option and in the run method. Is there a better way to achieve > > this than a global variable? > > I suggest making it a constant. > > COMPARE_TYPES = { "at_least" => :>=, "exactly" => :==, "no_more_than" > => :<=, > "more_than" => :>, "less_than" => :< } > > Regards, Morton Thanks for the tip. Didn't realize the scope of constants :-) This looks much better to me. Jesus.