Difference between revisions of "Template:LSL Function/negative index/range"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
{{#vardefine:spec|{{#if:{{#var:spec}}|{{#var:spec}}<br/>}} | {{#vardefine:spec|{{#if:{{#var:spec}}|{{#var:spec}}<br/>}} | ||
The first index starts at zero, the last index is <code>length - 1</code> or more easily written as <code>-1</code> | |||
*If '''{{{1}}}''' <= '''{{{2}}}''' then the range operated on starts at '''{{{1}}}''' and ends at '''{{{2}}}'''. ['''{{{1}}}''', '''{{{2}}}'''] | *If '''{{{1}}}''' <= '''{{{2}}}''' then the range operated on starts at '''{{{1}}}''' and ends at '''{{{2}}}'''. ['''{{{1}}}''', '''{{{2}}}'''] | ||
*If '''{{{1}}}''' <= '''{{{2}}}''' then the range operated on starts at '''{{{1}}}''' and ends at '''{{{2}}}'''. ['''0''', '''{{{2}}}'''] + ['''{{{1}}}''', '''-1'''] | *If '''{{{1}}}''' <= '''{{{2}}}''' then the range operated on starts at '''{{{1}}}''' and ends at '''{{{2}}}'''. ['''0''', '''{{{2}}}'''] + ['''{{{1}}}''', '''-1'''] |
Revision as of 18:06, 6 March 2007
The first index starts at zero, the last index is length - 1
or more easily written as -1
- If {{{1}}} <= {{{2}}} then the range operated on starts at {{{1}}} and ends at {{{2}}}. [{{{1}}}, {{{2}}}]
- If {{{1}}} <= {{{2}}} then the range operated on starts at {{{1}}} and ends at {{{2}}}. [0, {{{2}}}] + [{{{1}}}, -1]
See negative indexes for more information.