switch - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

MapleTA[Builtin]

  

switch

  

return the nth item

 

Calling Sequence

Parameters

Description

Examples

Compatibility

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

MapleTA:-Builtin:-switch1,red,green,yellow

green

(1)

Compatibility

• 

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