Include ternary operator ?: in expression editor

I would find it really powerful if the operator ?: can be used inside the expression editor. It would allow complex inline evaluations and help cut down on the amount of conditionals needed in visual elements.

[if this is true] ? [then evaluate this] : [else evaluate this]

Examples:

  1. Timer: When displaying seconds with leading zeros, pad it with β€˜0’ if seconds is less than 10.
    varSeconds < 10 ? 0varSeconds : varSeconds
  2. Building text: Add space character and last name if last name is present
    varLastName isn’t empty ? varFirstName varLastName : varFirstName
  3. Chain multiple conditions in one expression
    ((var1 is yes ? field1 : field2) == 10 ? yes : no)
4 Likes

It would also help if bubble could expand the :formatted as beyond number & text to return other objects

1 Like

The Expression element in the Toolbox can help with these situations. Ideally it would be built-in, a lot less awkward.

1 Like

Any update on this? It’s been a year.

1 Like