[chuck-users] good until loop

mike clemow michaelclemow at gmail.com
Fri Sep 24 20:24:09 EDT 2010


Hi Folks,

I've always done this:

now + 10::second => time later;

while (now < later) {
// do stuff...
}

since, "time < time" resolves to either true or false, then the while()
construct will work.

Mike

On Fri, Sep 24, 2010 at 1:57 PM, Tom Lieber <tom at alltom.com> wrote:

> On Fri, Sep 24, 2010 at 8:37 AM, Andrew C. Smith
> <andrewchristophersmith at gmail.com> wrote:
> > Yeah, I guess one thing we didn't really mention is that the argument
> > has to be a true/false value. until(5::second) won't work because
> > 5::second will not evaluate to true nor false. I think that's the main
> > misconception.
>
> Is that true? This works how I'd think it should:
>
>  until(5::second) {
>    <<< "won't happen" >>>;
>  }
>
>  do {
>    <<< "hi" >>>;
>    second => now;
>  } until(5::second);
>
>  while(5::second) {
>    <<< "bye" >>>;
>    second => now;
>  }
>
> --
> Tom Lieber
> http://AllTom.com/
> http://favmusic.net/
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>



-- 
http://michaelclemow.com
http://semiotech.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100924/640de478/attachment.htm>


More information about the chuck-users mailing list