20
I think the ability to use a ternary conditional statement would help many AL developers write cleaner code. How many times have we seen the following statement?
```
if then
MyVar :=
else
MyVar := ;
```

Refactoring to
`MyVar := ? : ;`
would be absolutely amazing.
Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future.

Best regards,
Business Central Team

Comments

Z

This would be fantastic!I've used Ternary operators in other languages and it's the one thing I really miss in AL development:result := (test1 = true ? 1 : (test2 = true ? 2 : 3));

Category: Development

Z

Also, this operator needs to work in the report columns expression.

Category: Development

Z

I don't know why I can't vote for this idea, but I support it 200%!

Category: Development

Z

Oof, the editor didn't like that, let's try again...

Being able to refactor the following code:
if {Boolean expression} then
MyVar := {Value 1}
else
MyVar := {Value 2}

to
MyVar := {Boolean expression} ? {Value 1} : {Value 2}

would be great.

Category: Development