From: Derek Cannon Date: 2009-12-14T00:04:30+09:00 Subject: Re: Code block for element comparison in an array? Seebs wrote: > On 2009-12-13, Derek Cannon wrote: >> I'm new to Ruby and I can't think of how to do this! I would like each >> element in an array to compare itself with all its proceeding elements. > > Why? I'm making a scheduler for my college courses! 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, and picks out classes are no more than 30 minutes apart from each other. (That's why I've got to compare all of the elements.) An example output looks like this so far: MONDAY/WEDNESDAY: VALID COURSE COMBINATIONS ITEC 3860 => "Software Development I" with [Dr. XYZ] (12:0-13:45) ITEC 3200 => "Intro to Databases" with [Dr. ABC] (14:0-15:15) *** OR *** ITEC 4820 => "Info Technology Project II" with [Dr. Lil'teapot] (12:0-13:45) ITEC 3200 => "Intro to Databases" with [Mr. Nodoctorate] (14:0-15:15) It's been a fun project to help familiarize me with Ruby! -- Posted via http://www.ruby-forum.com/.