Difference between revisions of "KeepIf Command"

From GeoGebra Manual
Jump to: navigation, search
m
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|logical}}
 
{{command|logical}}
; KeepIf[Condition, List]: Creates a new list that only contains those elements of the initial list that fulfill the condition.
+
; KeepIf[Condition, List]: Creates a new list that only contains those elements of the initial list that fulfil the condition.
 
: {{Example|1=<code>KeepIf[x<3, {1, 2, 3, 4, 1, 5, 6}]</code> returns the new list ''{1, 2, 1}''.}}
 
: {{Example|1=<code>KeepIf[x<3, {1, 2, 3, 4, 1, 5, 6}]</code> returns the new list ''{1, 2, 1}''.}}
 +
{{note|For list of numbers arbitrary condition may be used. For list of other objects one can use only conditions of the form <code>x==constant</code> or <code>x!=constant</code>.}}

Revision as of 21:44, 26 September 2011


KeepIf[Condition, List]
Creates a new list that only contains those elements of the initial list that fulfil the condition.
Example: KeepIf[x<3, {1, 2, 3, 4, 1, 5, 6}] returns the new list {1, 2, 1}.
Note: For list of numbers arbitrary condition may be used. For list of other objects one can use only conditions of the form x==constant or x!=constant.
© 2024 International GeoGebra Institute