Hi,

it's ITO Friday again and I would like to add a tiny builtin to
YCP.

  integer::range(integer n)
  integer::range(integer s, integer n)

It produces a list with the integers from 0 or s to n-1 (as known
from the Python range builtin).

  integer::range(3) -> [ 0, 1, 2 ]
  integer::range(1, 5) -> [ 1, 2, 3, 4 ]

It's useful to iterate over a sequence of numbers (like with a
'for' in C), e.g.:

  foreach(integer i, integer::range(size(addresses)), {
    y2milestone("Address No %1 is %2", i+1, addresses[i]);
  });

This is rather clumsy without range.

Comments?

ciao Arvin

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to