Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: cyclic values

From: gscottjones:mchsi at: 29-Sep-2002 7:09

From: "Patrick"
> I want to get values in order from a block, the first value > coming again after the last, and this forever. Is there a > better way than the one I am using now ? > > colors: [red green blue] > > ; I want color to be red, then green, then blue, then red again forever > ; the first value is duplicated > > color: first colors > append colors color > > ; then forever > color: select colors color
Hi, Patrick, This is just a slight variation: colors: [red green blue] color: first colors loop 100 [ if not color: select colors color [color: first colors] print color ] Of course, 'forever is substituted in place of 'loop. --Scott Jones