thank you. i will studying this.
<br/><br/>sincerely,
<br/><br/>Joe.
<br/><br/><br/><div class='shrinkable-quote'><br/>> On Apr 26, 2016, at 7:48 AM, Balázs Kósi [via Smalltalk] <<a href="/user/SendEmail.jtp?type=node&node=4892297&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>> wrote:
<br/>>
<br/>> categoriesByPayees := Dictionary new.
<br/>> FileStream readOnlyFileNamed: 'payees-by-categories.txt' do: [ :file |
<br/>> " With #readOnlyFileNamed:do: you don't have to worry about closing the file,
<br/>> it ensures that #close is sent to the file, even if you leave the block through an Exception. "
<br/>> [ file atEnd ] whileFalse: [
<br/>> | parts |
<br/>> parts := (file nextLine findTokens: $| escapedBy: Character tab)
<br/>> collect: #withBlanksCondensed.
<br/>> " We collect the parts #withBlanksCondensed, so we don't have to call it repeatedly in the loop.
<br/>> You can use unary selectors in place of blocks with one argument. You may look at the implementation
<br/>> of Collection >> #collect: and Symbol >> #value: to find out why. I'm not sure what you really want is
<br/>> #findTokens:escapedBy:, it cuts the string along | characters if they are not preceded by a tab."
<br/>> parts size > 1 ifTrue: [
<br/>> " We skip blank lines or categories without at least one payee. "
<br/>> | category |
<br/>> category := parts first.
<br/>> parts allButFirstDo: [ :payee |
<br/>> (categoriesByPayees
<br/>> at: payee
<br/>> ifAbsentPut: [ OrderedCollection new ]) add: category
<br/>> " Your implementation only remembers the last category encountered for a payee.
<br/>> We can collect all the categories. " ] ] ] ]
</div><br/>
        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://forum.world.st/go-to-the-end-of-a-loop-tp4891930p4892297.html">Re: go to the end of a loop</a><br/>
Sent from the <a href="http://forum.world.st/Squeak-Beginners-f107673.html">Squeak - Beginners mailing list archive</a> at Nabble.com.<br/>