Page 1 of 1

Ternary If

Posted: Mon Apr 05, 2021 8:02 pm
by devox
Hi,

Don't what people think to this idea? It would be nice if PB could do the equivalent to C#'s ternary operator.

C#

Code: Select all

int indent = HasDataLabelSet() ? 4 : 2;
PB

Code: Select all

Indent = If HasDataLabelSet() = #True : 4 : Else 2 : EndIf

Re: Ternary If

Posted: Mon Apr 05, 2021 8:49 pm
by BarryG
That's just "IIf" (according to Wikipedia for "ternary if") -> viewtopic.php?f=12&t=25788

Re: Ternary If

Posted: Mon Apr 05, 2021 9:03 pm
by STARGÅTE

Re: Ternary If

Posted: Mon Apr 05, 2021 9:38 pm
by devox
Ahh cheers @STARGÅTE and @BarryG