[Newbies] Re: next or break in a loop

Joseph Alotta joseph.alotta at gmail.com
Tue May 10 15:57:03 UTC 2016


Lou,

I was trying to use the ReadStream, but the issue is to get execution to go back to the top.  If I send the upToEnd message, it still executes from the same line and goes through the rest of the tests.


Sincerely,

Joe.



> On May 9, 2016, at 3:56 PM, Louis LaBrunda [via Smalltalk] <ml-node+s1294792n4894128h17 at n4.nabble.com> wrote:
> 
> Hi Joe, 
> 
> You can map your collection to a stream and then use the stream methods to traverse the 
> collection. 
> 
>         stream := ReadStream on: myCollection. 
>         [stream atEnd] whileFalse: [:item | 
>                 item := stream next. 
> "I'm not sure upToEnd is the right method here but it is close.  Look around, I'm sure you will 
> find what you need." 
>                 item doSomeWork. 
>                 (when you think you are done with item) ifTrue: [stream upToEnd]. 
>         ]. 
> 
> Lou 
> 
> On Mon, 9 May 2016 16:00:58 -0500, Joseph Alotta <[hidden email]> wrote: 
> 
> >I don’t think any of the solutions work for my case. 
> > 
> >I want to evaluate several different variable for each step, make calculations and if all of the conditions are met, then skip to the next item, otherwise, do the next step of calculations. 
> > 
> >The project is reading comma deliminated bank or credit card files, taking a column of data, counting various characters, and trying to determine what kind of data it is.  For example, a column of data with two slash characters and eight digits per line is likely to be a date field.  A column of data with more than 3 letter characters and a percentage of digits and a percentage of hash signs is likely to be a payee field.  A column of data with no spaces, no digits, no special characters is likely to be a type of transaction field.  A column of data with one period per item, and only digits or a minus sign is  likely to be a amount field, and a column of data with a high percentage of zero length items and the rest having C or K and a pound sign and four or more digits is likely to be a check number field. 
> > 
> >I am doing a lot of tests for each field and I don’t think the switch is a good fit. 
> > 
> >Sincerely, 
> > 
> >Joe.
> -- 
> Louis LaBrunda 
> Keystone Software Corp. 
> SkypeMe callto://PhotonDemon 
> 
> _______________________________________________ 
> Beginners mailing list 
> [hidden email] 
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://forum.world.st/next-or-break-in-a-loop-tp4894095p4894128.html
> To start a new topic under Squeak - Beginners, email ml-node+s1294792n107673h12 at n4.nabble.com 
> To unsubscribe from Squeak - Beginners, click here.
> NAML





--
View this message in context: http://forum.world.st/next-or-break-in-a-loop-tp4894095p4894218.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160510/8978f301/attachment-0001.htm


More information about the Beginners mailing list