The condition function allows you to give alternative results based on whether the value of a particular condition is True or False. You can use the condition function with Input, Show, Message, and Log fields.

## Condition function example

Consider the Input field syntax below:

*Input("Input the bar diameter - minimum "+String(D_{min},"F0","mm")+" mm","Dia","mm", if(D_{min}>Dia, string(D_{min},"F0","mm"), string(Dia,"F0","mm")),2)*

In this case, the default value for the variable *Dia* depends on whether the minimum bar diameter is greater than the actual diameter.

You can see this more clearly if we isolate the condition from the rest of the field:

*if(D_{min}>Dia, string(D_{min},"F0","mm"), string(Dia,"F0","mm"))*

If we further remove the string expressions, replacing them with *D_{min}* and *Dia* we get

*if(D_{min}>Dia, D_{min}, Dia)* .

Now the condition is much easier to see: if *D_{min}* is greater than *Dia*, the input dialog has its default value set to *D_{min}*.

If *D_min* is less than or equal to *Dia*, then its default value will be set to *Dia*.

Note: If you want to use complex conditions in your calculations, you may find it useful to create the overall structure of the field, and then divide the field syntax into pieces.

You must use expression text format for non alphanumeric characters.