toString function and String concatenation should also allow Boolean values - Mendix Forum

toString function and String concatenation should also allow Boolean values

7

Now I have to write:

if ($isTrue) then 'true' 
else 'false'

instead of:

toString($isTrue) or even shorter: '' + $isTrue

when using a Boolean value as a parameter in for instance a Log message. 

Yet it would even be better if the type of parameter didn't matter at all. One is composing a text (String) so the system should be able to convert every parameter type into a String. As far as Java is concerned every object has a toString method and String.valueOf(obj) could be used to avoid NullPointerExceptions. So it seems like a sensibel thing to support.

asked
1 answers

I completely agree. Also, it should be possible to omit the toString() call altogether in these cases. If you need to you could still write

($one + $two) if you want 3 printed instead of 12.

Created