REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 6-Feb-2009 Edit History  

REBOL 3 Concepts: Series: Multiple Series Variables

Pending Revision

This document was written for R2 and has yet to be revised for R3.

Multiple variables can refer to the same series. For instance:

data: [1 2 3 4 5]
start: find data 3
end: find start 4
print first start
print first end

Both the start and end variables refer to the series. They have different positions, but the series they reference is the same.

If an insert or remove function is performed on a series, the values in the series will shift and the start and end variables may no longer refer to the same values. For instance, if a value is removed from the series at the start position:

remove start
print first start
print first end

The series has shifted to the left and the variables now refer to different values.

Notice that the index positions of the variables have not changed, but the values in the series have changed. The same situation would occur when using insert.

Sometimes this side effect will work to your advantage. Sometimes it will not, and you will need to correct for it in your code.

  TOC < Back Next > - WIP Wiki Feedback Admin