<div dir="ltr">Yes, except #whileFalse: only works against blocks. So:<div><span style="font-size:12.8px">     [f atEnd] whileFalse: [   </span><br style="font-size:12.8px"></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 25, 2016 at 9:59 AM, Joseph Alotta <span dir="ltr">&lt;<a href="mailto:joseph.alotta@gmail.com" target="_blank">joseph.alotta@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Louis,
<br><br>This is not a school project.  I was looking for a local tutor but could find none.  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: [  
<br>                line := f nextLine
<br><br>                (line size &lt; 2) ifFalse:  [ “process line”].
<br><br>].
<br><br><br>Sincerely,
<br><br>Joe.
<br><br><br><br><br><div><span class=""><br>&gt; On Apr 25, 2016, at 10:06 AM, Louis LaBrunda [via Smalltalk] &lt;<a href="http:///user/SendEmail.jtp?type=node&amp;node=4891963&amp;i=0" rel="nofollow" link="external" target="_blank">[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.  You would then use a #whileFalse: and move the #nextLine 
<br>&gt; call into the second block of the whileFalse:.  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.   If this is not a school project, we can be of more help, we just don&#39;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></span><div><div class="h5">&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: [        | array cat payees | 
<br>&gt; &gt;        
<br>&gt; &gt;                          array := line  findTokens: $| escapedBy:  Character tab . 
<br>&gt; &gt; 
<br>&gt; &gt;        cat := array first. 
<br>&gt; &gt;        payees := array reject: [ :i | i = cat ].   &quot;rest of the line&quot; 
<br>&gt; &gt;        
<br>&gt; &gt;        payees do:  [ :p |   mydict at: (p withBlanksCondensed) put: (cat withBlanksCondensed)]. 
<br>&gt; &gt;                          ]. 
<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.  Lines with just a Character cr.  I was wondering how to handle that.  In other languages, there is a break for the loop, to go to the end.  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.  So where do I put this.  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 <a href="callto://PhotonDemon" target="_blank">callto://PhotonDemon</a> 
<br>&gt; 
<br>&gt; _______________________________________________ 
<br>&gt; Beginners mailing list 
<br></div></div>&gt; [hidden email] 
<br>&gt; <a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" rel="nofollow" link="external" target="_blank">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" rel="nofollow" link="external" target="_blank">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="http:///user/SendEmail.jtp?type=node&amp;node=4891963&amp;i=1" rel="nofollow" link="external" target="_blank">[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" target="_blank">Re: go to the end of a loop</a><br>
Sent from the <a href="http://forum.world.st/Squeak-Beginners-f107673.html" target="_blank">Squeak - Beginners mailing list archive</a> at Nabble.com.<br><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>