B.60 SwitchTask

Task definition for the phing task to switch on a particular value.

Table B.62: Attributes

valueStringThe value to switch on.n/aYes
caseinsensitiveBooleanShould we do case insensitive comparisons?falseNo

B.60.1 Supported Nested Tags

At least one <case> or <default> is required.


An individual case to consider, if the value that is being switched on matches to value attribute of the case, then the nested tasks will be executed.

Table B.63: Attributes

valueStringThe value to match against the tasks value attribute.n/aYes


The default case for when no match is found. Must not appear more than once per task.

B.60.2 Examples

<switch value="${foo}">
    <case value="bar">
        <echo message="The value of property foo is bar" />
    <case value="baz">
        <echo message="The value of property foo is baz" />
        <echo message="The value of property foo is not sensible" />