Re: newbie: foreach
- From: miguel sofer <msofer@xxxxxxxxxxxx>
- Date: Tue, 16 Aug 2005 18:37:11 -0300
keithv wrote:
miguel sofer wrote:
Kev P. wrote:
I'm sure the below can be simplified with some sort of "foreach", but so far I've failed. Anyone help please? Snippet of code attached:
The use of foreach and arrays has been illustrated by the previous replies; I just want to suggest replacing your busy loop with an event-based processing. The difference is that your script will take as much cpu as available while waiting for user input, and this will just idle.
Pardon my ignorance but I thought that in the original code the line "gets stdin line" will block inside the OS and not consume cpu cycles.
Keith
Indeed, I somehow forgot that stdin is blocking by default :(
I (tried) to delete that message right after noticing my boo-boo, and sent another message with essentially this remark.
Ever so sorry, my bad.
Miguel
.
- References:
- newbie: foreach
- From: Kev P.
- Re: newbie: foreach
- From: miguel sofer
- Re: newbie: foreach
- From: keithv
- newbie: foreach
- Prev by Date: Re: Windows and binding mouse buttons
- Next by Date: Re: "lsort -unique" and maintaining ORDER
- Previous by thread: Re: newbie: foreach
- Next by thread: Re: newbie: foreach (oops)
- Index(es):