Difference between revisions of "Last Command"

From GeoGebra Manual
Jump to: navigation, search
Line 1: Line 1:
 
<noinclude>{{Manual Page|version=4.0}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude>
 
<noinclude>{{Manual Page|version=4.0}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude>
 
{{command|list}}
 
{{command|list}}
; Last[List L]: Returns list containing the last element of the list L.
+
;Last[ <List L> ]
{{Example|1=<code>Last[{1,2,3}]</code> returns {3}.}}
+
:Gives a new list that contains the last element of the list ''L''.
To get the last element itself use e.g. [[Element Command]].
+
:{{example|1=<div><code><nowiki>Last[{1, 4, 3}]</nowiki></code> yields ''{3}''.</div>}}
; Last[List L, Number n of Elements]: Returns a list containing just the last ''n'' elements of the list L.
+
:{{note| 1=To get the last element use <code><nowiki>Element[{1, 4, 3}, 3]</nowiki></code>.}}
;Last[Text]:Returns last character of the text.
+
;Last[ <List L>, <Number n of elements> ]
;Last[Text, Number n of Elements]: Returns the last ''n'' characters of the text.
+
:Gives a new list that contains just the last ''n'' elements of the list ''L''.
{{Example|1=<code>Last["Hello",2]</code> returns "lo".}}
+
:{{example|1=<div><code><nowiki>Last[{1, 4, 3}, 2]</nowiki></code> yields ''{4, 3}''.</div>}}
 +
;Last[ <Text> ]
 +
:Gives last character of the text.
 +
:{{example|1=<div><code><nowiki>Last["Hello"]</nowiki></code> yields ''"o"''.</div>}}
 +
;Last[ <Text> , <Number n of elements> ]
 +
:Gives the last''n'' characters of the text.
 +
:{{example|1=<div><code><nowiki>Last["Hello",2]</nowiki></code> yields ''"lo"''.</div>}}
 
==CAS Syntax==
 
==CAS Syntax==
; Last[List L]: Returns list containing the last element of the list L.
+
;Last[ <List L> ]
{{Example|1=<code>Last[{a,b,c}]</code> returns {c}.}}
+
:Gives a new list that contains the last element of the list ''L''.
To get the last element itself use e.g. [[Element Command]].
+
:{{example|1=<div><code><nowiki>Last[{1, 4, 3}]</nowiki></code> yields ''{3}''.</div>}}
; Last[List L, Number n of Elements]: Returns a list containing just the last ''n'' elements of the list L.
+
:{{note| 1=To get the last element use <code><nowiki>Element[{1, 4, 3}, 3]</nowiki></code>.}}
 +
;Last[ <List L>, <Number n of elements> ]
 +
:Gives a new list that contains just the last ''n'' elements of the list ''L''.
 +
:{{example|1=<div><code><nowiki>Last[{1, 4, 3}, 2]</nowiki></code> yields ''{1, 4}''.</div>}}

Revision as of 10:15, 18 August 2011


Last[ <List L> ]
Gives a new list that contains the last element of the list L.
Example:
Last[{1, 4, 3}] yields {3}.
Note: To get the last element use Element[{1, 4, 3}, 3].
Last[ <List L>, <Number n of elements> ]
Gives a new list that contains just the last n elements of the list L.
Example:
Last[{1, 4, 3}, 2] yields {4, 3}.
Last[ <Text> ]
Gives last character of the text.
Example:
Last["Hello"] yields "o".
Last[ <Text> , <Number n of elements> ]
Gives the lastn characters of the text.
Example:
Last["Hello",2] yields "lo".

CAS Syntax

Last[ <List L> ]
Gives a new list that contains the last element of the list L.
Example:
Last[{1, 4, 3}] yields {3}.
Note: To get the last element use Element[{1, 4, 3}, 3].
Last[ <List L>, <Number n of elements> ]
Gives a new list that contains just the last n elements of the list L.
Example:
Last[{1, 4, 3}, 2] yields {1, 4}.
© 2024 International GeoGebra Institute