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

[REBOL] Re: Loop with negative count

From: greggirwin:mindspring at: 27-Dec-2006 19:02

Hi Tim,
>>> help loop
TJ> makes no reference to negative values for the 'count argument. TJ> consider the following console session
>>> test: []
TJ> == []
>>> loop -4 [append test "hello"] >>> test
TJ> == [] TJ> Can we reliably expect that a negative argument will be ignored? So far. :) In the case of LOOP and REPEAT, it seems safe to say that negative values make no sense, and will always be ignored. Others may argue that REBOL should throw an error, but I imagine Carl considered that behavior and chose not to do it, so you're probably safe. Maybe we can get a quick answer from him to be sure though. I wouldn't feel safe saying the same thing about all other functions. For example, FORSKIP/FORALL changed, but hopefully for the better since negative numbers would loop forever before, and now throw an error. -- Gregg