| Line 37... |
Line 37... |
| 37 |
matched (exactly) to the names of the elements in \code{\dots}. If
|
37 |
matched (exactly) to the names of the elements in \code{\dots}. If
|
| 38 |
there is a match then that element is evaluated unless it is missing,
|
38 |
there is a match then that element is evaluated unless it is missing,
|
| 39 |
in which case the next non-missing element is evaluated, so for
|
39 |
in which case the next non-missing element is evaluated, so for
|
| 40 |
example \code{switch("cc", a = 1, cc =, cd =, d = 2)} evaluates to
|
40 |
example \code{switch("cc", a = 1, cc =, cd =, d = 2)} evaluates to
|
| 41 |
\code{2}. If there is more than one match, the first matching element
|
41 |
\code{2}. If there is more than one match, the first matching element
|
| 42 |
is used. In the case of no match, if there is a unnamed element of
|
42 |
is used. In the case of no match, if there is an unnamed element of
|
| 43 |
\code{\dots} its value is returned. (If there is more than one such
|
43 |
\code{\dots} its value is returned. (If there is more than one such
|
| 44 |
argument an error is signaled.)
|
44 |
argument an error is signaled.)
|
| 45 |
|
45 |
|
| 46 |
The first argument is always taken to be \code{EXPR}: if it is named
|
46 |
The first argument is always taken to be \code{EXPR}: if it is named
|
| 47 |
its name must (partially) match.
|
47 |
its name must (partially) match.
|
| 48 |
|
48 |
|
| 49 |
A warning is signaled if no alternatives are provides, as this is
|
49 |
A warning is signaled if no alternatives are provided, as this is
|
| 50 |
usually a coding error.
|
50 |
usually a coding error.
|
| 51 |
|
51 |
|
| 52 |
This is implemented as a \link{primitive} function that only evaluates
|
52 |
This is implemented as a \link{primitive} function that only evaluates
|
| 53 |
its first argument and one other if one is selected.
|
53 |
its first argument and one other if one is selected.
|
| 54 |
}
|
54 |
}
|