###--- >>> `switch' <<<----- Select One of a List of Alternatives

	## alias	 help(switch)

##___ Examples ___:

centre <- function(x, type) {
  switch(type,
        mean = mean(x),
        median = median(x),
        trimmed = mean(x, trim = .1))
}
x <- rcauchy(10)
centre(x, "mean")
centre(x, "median")
centre(x, "trimmed")

ccc <- c("b","QQ","a","A","bb")
for(ch in ccc) cat(ch,":",switch(ch, a=1,    b=2:3),            "\n")
for(ch in ccc) cat(ch,":",switch(ch, a=,A=1, b=2:3, "Otherwise: last"),"\n")

## Numeric EXPR don't allow an `otherwise':
for(i in c(-1:3,9))  print(switch(i, 1,2,3,4))

## Keywords: 'programming'.


