23
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
Planned
Ideas Administrator

Thank you for this suggestion! This is being added to 2024 release wave 2.

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