From: Suraj Kurapati Date: 2008-07-01T07:45:41+09:00 Subject: Re: Ruby good-practice I単aki Baz Castillo wrote: > El Martes, 1 de Julio de 2008, Justin To escribi坦: > >> 1) What's the stance on global variables? When to use them, if at all? > > AFAIK try not using them (except if they are really needed). Agreed. Prefer constants, class variables, then global variables, in that order. >> 2) Two arrays that have related info. (i.e. a[0] relates to b[0]) or one >> hash? > > A Hash, of course (IMHO). If the problem domain prefers arrays, you can iterate them using Array#zip: a.zip(b).each {|ai,bi| ... } # ai is a[i], bi is b[i], where i = 0 to max(a,b) Always use data structures that best suit the problem domain, IMHO. -- Posted via http://www.ruby-forum.com/.