Hi Louis,
<br/><br/>This is not a school project. &nbsp;I was looking for a local tutor but could find none. &nbsp;So this is me doing this instead of working crossword puzzles or sudukos.
<br/><br/>So your advice would be:
<br/><br/>(f atEnd) whileFalse: [ &nbsp;
<br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; line := f nextLine
<br/><br/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (line size &lt; 2) ifFalse: &nbsp;[ “process line”].
<br/><br/>].
<br/><br/><br/>Sincerely,
<br/><br/>Joe.
<br/><br/><br/><br/><br/><div class='shrinkable-quote'><br/>&gt; On Apr 25, 2016, at 10:06 AM, Louis LaBrunda [via Smalltalk] &lt;<a href="/user/SendEmail.jtp?type=node&node=4891963&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt; wrote:
<br/>&gt; 
<br/>&gt; Hi Joe, 
<br/>&gt; 
<br/>&gt; Better than checking for #nextLine answering nil, I think you can send the file stream #atEnd 
<br/>&gt; to see if there is any more data. &nbsp;You would then use a #whileFalse: and move the #nextLine 
<br/>&gt; call into the second block of the whileFalse:. &nbsp;Then test for empty lines with something like: 
<br/>&gt; (line size &lt; 2) ifFalse: [...putting all the code that does the work on a line with data in 
<br/>&gt; here...]. 
<br/>&gt; 
<br/>&gt; Lou 
<br/>&gt; 
<br/>&gt; PS. &nbsp; If this is not a school project, we can be of more help, we just don't like doing 
<br/>&gt; students projects for them as they learn more with just a few hints and not real code. 
<br/>&gt; 
<br/>&gt; On Mon, 25 Apr 2016 10:16:33 -0500, Joseph Alotta &lt;[hidden email]&gt; wrote: 
<br/>&gt; 
<br/>&gt; &gt;Greetings, 
<br/>&gt; &gt; 
<br/>&gt; &gt;I have this code: 
<br/>&gt; &gt; 
<br/>&gt; &gt;****** 
<br/>&gt; &gt; 
<br/>&gt; &gt;read 
<br/>&gt; &gt;        &quot;read the category file into the dictionary 
<br/>&gt; &gt;        the first item is the category, the rest of the line are payees 
<br/>&gt; &gt;        
<br/>&gt; &gt;        office expense|home depot|staples|costco 
<br/>&gt; &gt;        groceries|natures best|jewel|trader joes|fresh thyme 
<br/>&gt; &gt;        &quot; 
<br/>&gt; &gt; 
<br/>&gt; &gt;| f line | 
<br/>&gt; &gt;f := FileStream oldFileNamed: myfile. 
<br/>&gt; &gt; 
<br/>&gt; &gt;[(line := f nextLine) notNil] whileTrue: [ &nbsp; &nbsp; &nbsp; &nbsp;| array cat payees | 
<br/>&gt; &gt;        
<br/>&gt; &gt;         &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;array := line &nbsp;findTokens: $| escapedBy: &nbsp;Character tab . 
<br/>&gt; &gt; 
<br/>&gt; &gt;        cat := array first. 
<br/>&gt; &gt;        payees := array reject: [ :i | i = cat ]. &nbsp; &quot;rest of the line&quot; 
<br/>&gt; &gt;        
<br/>&gt; &gt;        payees do: &nbsp;[ :p | &nbsp; mydict at: (p withBlanksCondensed) put: (cat withBlanksCondensed)]. 
<br/>&gt; &gt;         &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;]. 
<br/>&gt; &gt; 
<br/>&gt; &gt; 
<br/>&gt; &gt;f close. 
<br/>&gt; &gt; 
<br/>&gt; &gt;********* 
<br/>&gt; &gt; 
<br/>&gt; &gt;I am getting some blank lines in the data file. &nbsp;Lines with just a Character cr. &nbsp;I was wondering how to handle that. &nbsp;In other languages, there is a break for the loop, to go to the end. &nbsp;I can do: 
<br/>&gt; &gt; 
<br/>&gt; &gt;(line size &lt; 2) ifTrue: [ f nextLine.]. 
<br/>&gt; &gt; 
<br/>&gt; &gt;But that would interfere with the notNil idiom at the end of the file. &nbsp;So where do I put this. &nbsp;Is there a common way to jump to the end? 
<br/>&gt; &gt; 
<br/>&gt; &gt; 
<br/>&gt; &gt;Sincerely, 
<br/>&gt; &gt; 
<br/>&gt; &gt; 
<br/>&gt; &gt;Joe.
<br/>&gt; -- 
<br/>&gt; Louis LaBrunda 
<br/>&gt; Keystone Software Corp. 
<br/>&gt; SkypeMe callto://PhotonDemon 
<br/>&gt; 
<br/>&gt; _______________________________________________ 
<br/>&gt; Beginners mailing list 
<br/>&gt; [hidden email] 
<br/>&gt; <a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_top" rel="nofollow" link="external">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br/>&gt; 
<br/>&gt; 
<br/>&gt; If you reply to this email, your message will be added to the discussion below:
<br/>&gt; <a href="http://forum.world.st/go-to-the-end-of-a-loop-tp4891930p4891939.html" target="_top" rel="nofollow" link="external">http://forum.world.st/go-to-the-end-of-a-loop-tp4891930p4891939.html</a><br/>&gt; To start a new topic under Squeak - Beginners, email <a href="/user/SendEmail.jtp?type=node&node=4891963&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a> 
<br/>&gt; To unsubscribe from Squeak - Beginners, click here.
<br/>&gt; NAML
</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-tp4891930p4891963.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/>