Difference between revisions of "Insert Command"

From GeoGebra Manual
Jump to: navigation, search
m
(command syntax: changed [ ] into ( ))
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|list}}
 
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|list}}
;Insert[ <Object>, <List>, <Position> ]:Inserts the object in the list at the given position.
+
;Insert( <Object>, &lt;List>, <Position> ):Inserts the object in the list at the given position.
:{{Example|1=<div><code>Insert[x^2, {1, 2, 3, 4, 5}, 3]</code> places ''x<sup>2</sup>'' at the third position and creates the list ''{1, 2, x<sup>2</sup>, 3, 4, 5}''.</div>}}
+
:{{Example|1=<div><code>Insert(x^2, {1, 2, 3, 4, 5}, 3)</code> places ''x<sup>2</sup>'' at the third position and creates the list ''{1, 2, x<sup>2</sup>, 3, 4, 5}''.</div>}}
 
:{{Note|1=If the position is a negative number, then the position is counted from the right.}}
 
:{{Note|1=If the position is a negative number, then the position is counted from the right.}}
:{{Example|1=<div><code>Insert[x^2, {1, 2, 3, 4, 5}, -1]</code> places ''x<sup>2</sup>'' at the end of the list and creates the list ''{1, 2, 3, 4, 5, x<sup>2</sup>}''.</div>}}
+
:{{Example|1=<div><code>Insert(x^2, {1, 2, 3, 4, 5}, -1)</code> places ''x<sup>2</sup>'' at the end of the list and creates the list ''{1, 2, 3, 4, 5, x<sup>2</sup>}''.</div>}}
;Insert[ <List>, <List>, <Position> ]:Inserts all elements of the first list in the second list at the given position.
+
;Insert( &lt;List>, &lt;List>, <Position> ):Inserts all elements of the first list in the second list at the given position.
:{{Example|1=<div><code>Insert[{11, 12}, {1, 2, 3, 4, 5}, 3]</code> places the elements of the first list at the third (and following) position(s) of the second list and creates the list ''{1, 2, 11, 12, 3, 4, 5}''.</div>}}
+
:{{Example|1=<div><code>Insert({11, 12}, {1, 2, 3, 4, 5}, 3)</code> places the elements of the first list at the third (and following) position(s) of the second list and creates the list ''{1, 2, 11, 12, 3, 4, 5}''.</div>}}
 
:{{Note|1=If the position is a negative number, then the position is counted from the right.}}
 
:{{Note|1=If the position is a negative number, then the position is counted from the right.}}
:{{Example|1=<div><code>Insert[{11, 12}, {1, 2, 3, 4, 5}, -2]</code> places the elements of the first list at the end of the second list before its last element and creates the list ''{1, 2, 3, 4, 11, 12, 5}''.</div>}}
+
:{{Example|1=<div><code>Insert({11, 12}, {1, 2, 3, 4, 5}, -2)</code> places the elements of the first list at the end of the second list before its last element and creates the list ''{1, 2, 3, 4, 11, 12, 5}''.</div>}}

Latest revision as of 10:19, 6 October 2017


Insert( <Object>, <List>, <Position> )
Inserts the object in the list at the given position.
Example:
Insert(x^2, {1, 2, 3, 4, 5}, 3) places x2 at the third position and creates the list {1, 2, x2, 3, 4, 5}.
Note: If the position is a negative number, then the position is counted from the right.
Example:
Insert(x^2, {1, 2, 3, 4, 5}, -1) places x2 at the end of the list and creates the list {1, 2, 3, 4, 5, x2}.
Insert( <List>, <List>, <Position> )
Inserts all elements of the first list in the second list at the given position.
Example:
Insert({11, 12}, {1, 2, 3, 4, 5}, 3) places the elements of the first list at the third (and following) position(s) of the second list and creates the list {1, 2, 11, 12, 3, 4, 5}.
Note: If the position is a negative number, then the position is counted from the right.
Example:
Insert({11, 12}, {1, 2, 3, 4, 5}, -2) places the elements of the first list at the end of the second list before its last element and creates the list {1, 2, 3, 4, 11, 12, 5}.
© 2024 International GeoGebra Institute