Ternary operator

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Ternary operator

Post by StarBootics »

Hello everyone,

I suggest to add the Ternary operator like in C or C++ to PB language.

Code: Select all

int c1 = (x0 > y0) ? 32 : 0;
This the Macro I'm currently using for that :

Code: Select all

Macro Interrogation(Variable, Test, If_True, If_False)
    
  If Test
    Variable = (If_True)
  Else 
    Variable = (If_False)
  EndIf 
    
EndMacro
Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Ternary operator

Post by User_Russian »

Post Reply