Question: I am trying to print some message in Ant depending on some condition as follow:

```
<if>
    <equals arg1="${docs.present}" arg2="true"/>
    <then>
    </then>
    <else>
        <echo message="No docss found!"/>
    </else>
</if>

```

But as you see, if docs.present property is set to 'true' then only I want to execute only else part. There is nothing to execute in if part. How can I achieve this?

Answer: 
You can use `echo` in your `if` condition instead of else as below :

```
<if>
    <equals arg1="${docs.present}" arg2="false"/>
    <then>
          <echo message="No docss found!"/>
    </then>
</if>

```
Below is the typical example of writing if, else if and else conditions in ant.

```
<if>
    <equals arg1="${condition}" arg2="true"/>
    <then>
        <copy file="${some.dir}/file" todir="${another.dir}"/>
    </then>
    <elseif>
        <equals arg1="${condition}" arg2="false"/>
        <then>
            <copy file="${some.dir}/differentFile" todir="${another.dir}"/>
        </then>
    </elseif>
    <else>
        <echo message="Condition was neither true nor false"/>
    </else>
</if>

```

In your case you can have the task to be performed inside the `then` tag itself and remove `else` tag if you have nothing to be performed there.

```
<if>
    <equals arg1="${docs.present}" arg2="false"/>
    <then>
        <echo message="No docss found!"/>
    </then>
</if>

```