MapleTA[Builtin] - Maple Programming Help

Home : Support : Online Help : Connectivity : Maple T.A. : MapleTA Package : Builtin : MapleTA/Builtin/switch

MapleTA[Builtin]

 switch
 return the nth item

 Calling Sequence switch(n, a, b, c, ...)

Parameters

 n - integer a, b, c - anything

Description

 • 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.

Examples

 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{switch}\left(1,"red","green","yellow"\right)$
 ${"green"}$ (1)

Compatibility

 • The MapleTA[Builtin][switch] command was introduced in Maple 18.