Ternary If

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
devox
User
User
Posts: 32
Joined: Thu Apr 01, 2021 7:25 pm

Ternary If

Post 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
BarryG
Addict
Addict
Posts: 3294
Joined: Thu Apr 18, 2019 8:17 am

Re: Ternary If

Post by BarryG »

That's just "IIf" (according to Wikipedia for "ternary if") -> viewtopic.php?f=12&t=25788
devox
User
User
Posts: 32
Joined: Thu Apr 01, 2021 7:25 pm

Re: Ternary If

Post by devox »

Ahh cheers @STARGÅTE and @BarryG
Post Reply