MapleTA[Builtin]
switch
return the nth item
Calling Sequence
Parameters
Description
Examples
Compatibility
switch(n, a, b, c, ...)
n
-
integer
a, b, c
anything
Given a whole number 0, 1, 2, ... and a sequence of items, the switch command returns the nth item in the sequence.
The first item is in position 0, the second in position 1, and so on.
For example, switch(rint(5), 2, 3, 5, 7, 11) returns a random choice from the first 5 primes.
MapleTA:-Builtin:-switch⁡1,red,green,yellow
green
The MapleTA[Builtin][switch] command was introduced in Maple 18.
For more information on Maple 18 changes, see Updates in Maple 18.
See Also
MapleTA
Download Help Document