This built-in exists since FreeMarker 2.3.20.
Note that this built-in also works on strings.
Converts a boolean to a string. You can use it in two ways:
As foo?string("yes", "no"): This will return the first parameter (here: "yes") if the boolean is true, otherwise the second parameter (here: "no"). Note that the return value is always a string; if the parameters were numbers, they would be converted to strings first.
foo?string: Deprecated starting from FreeMarker 2.3.20: use ?c instead, or set the boolean_format setting to something like "yes,no" and then the conversion can happen automatically. If you still need to know about this, this will convert the boolean to string using the default strings for representing true and false values. By default, true is rendered as "true" and false is rendered as "false". This is mostly useful if you generate source code with FreeMarker (but use ?c for that starting from 2.3.20), since the values are not locale (language, country) sensitive. To change these default strings, you can use the boolean_format setting.
Note, that in the very rare case when a value is multi-typed and is both a boolean and a string, then the string value of the variable will be returned, and so the boolean_format setting will have no effect.