{title:'Logic Variables'}

The default variable resolver also provides the following logic variables for performing simple logical operations:

The $IF variable can be used for simple if/else logic:

| # Value set to 'foo' if myBooleanProperty is true | key1 = | $IF{ | $S{myBooleanProperty}, | foo | } | | # Value set to 'foo' if myBooleanProperty is true, 'bar' if false. | key2 = | $IF{ | $S{myBooleanProperty}, | foo, | bar | } | | # Value set to key1 value if myBooleanProperty is true, key2 value if false. | key3 = | $IF{ | $S{myBooleanProperty}, | $C{key1}, | $C{key2} | }

The $SW variable can be used for switch blocks based on pattern matching:

| # Shell command depends on the OS | shellCommand = | $SW{ | $LC{$S{os.name}}, | *win*: bat, | linux: bash, | *: sh | }

The $CO variable can be used for coalescing of values (finding the first non-null/empty match):

| # Debug flag can be enabled by system property or environment variable. | debug = | $CO{ | $S{debug}, | $E{DEBUG}, | false | }

The $PM variable can be used for calculating boolean values:

| # Debug flag can be enabled by system property or environment variable. | isWindows = | $PM{ | $LC{$S{os.name}}, | *win* | }