Other ways to use inject: (functional programming)
P | N


| aString |

aString := 'Now is the time for all good men to come to the aid of their blah blah blah'.

aString inject: 0

into: [:count :nextElement |

count + (nextElement asLowercase == $a ifTrue: [1] ifFalse: [0])]

"--> 5"


Previous | Next


Last modified at 7/24/97; 1:43:25 PM
Other Links of Interest
College of Computing | EduTech Institute | GVU Center
Mark Guzdial | Papers | CS 2390 Spring '97 Home Page | STABLE | MMC-CaMILE

Slide Master