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