From: "Shot (Piotr Szotkowski)" Date: 2009-12-14T01:16:15+09:00 Subject: Re: Code block for element comparison in an array? --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Derek Cannon: > First, it picks out the courses I need to take (based on what is being > offered that semester) and stores it in an array. Then it checks the > array, comparing the elements to all the others Then you might be interested in Array#combination: classes =3D ['devel', 'databases', 'IT'] classes.combination(2).each do |a, b| puts "comparing #{a} with #{b}" end comparing devel with databases comparing devel with IT comparing databases with IT =E2=80=94 Shot --=20 Not all code needs to be a factory, some of it can just be origami. [_why] --FL5UXtIhxfXey3p5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkslE0sACgkQi/mCfdEo8UrsWACfUTQElb8dPPMtpjIOL3kRxXmZ 8CgAn0GSjv1P6jvRrLktccmCtG/z+X9K =X34B -----END PGP SIGNATURE----- --FL5UXtIhxfXey3p5--