DEV Community

Cover image for Ternary operator in Power Automate
Wellington Brandão
Wellington Brandão

Posted on

Ternary operator in Power Automate

How to use ternary operator in power automate?

Well, before to I show you, let's go over some concepts...

1.
The ternary operator structure

Image description

  1. The expression must be a boolean value (true or false), never put an object, array, or string, as it will return an error:

Image description

Applying ternary operator
"What do I make, if my expression is an object, array, or string?"
In this case, we can use the operators: Greater, Less, or Equals.
For example:

Image description

if(variables('Age') > 19,'Yes', 'No') ❌
if(greater(variables('Age'),19),'Yes', 'No') ✅

If the age is greater than 19, show yes in compose

The result:

Image description

That's all for today! 🤟🏻

Top comments (0)