CSC/ECE 517 Summer 2008/wiki1 2 itr: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
One of the beloved feature of [http://www.ruby-lang.org/en/| Ruby] is the block based Iterator. A Ruby Iterator is simply a method that somehow loops over the contents of an object. | One of the beloved feature of [http://www.ruby-lang.org/en/| Ruby] is the block based [http://en.wikipedia.org/wiki/Iterator| Iterator]. A Ruby Iterator is simply a method that somehow loops over the contents of an object. | ||
The verb `iterate' means "do the same thing many times' so `iterator' means "one which does the same thing many times'. It can also be considered as an object that behaves like a generic pointer. The iterator usually reference to one particular element in the object collection and then modify itself so that it points to the next element. | The verb `iterate' means "do the same thing many times' so `iterator' means "one which does the same thing many times'. It can also be considered as an object that behaves like a generic pointer. The iterator usually reference to one particular element in the object collection and then modify itself so that it points to the next element. | ||
Revision as of 02:39, 30 May 2008
Introduction
One of the beloved feature of Ruby is the block based Iterator. A Ruby Iterator is simply a method that somehow loops over the contents of an object. The verb `iterate' means "do the same thing many times' so `iterator' means "one which does the same thing many times'. It can also be considered as an object that behaves like a generic pointer. The iterator usually reference to one particular element in the object collection and then modify itself so that it points to the next element.
Numbering
- A
- a
- B
- b
Bullets
- A
- a
- B
- b