Just saw this code snippet posted on the Facebook Delphi Developer group, a Pascal version of the C/C++/C# ternary...

Just saw this code snippet posted on the Facebook Delphi Developer group, a Pascal version of the C/C++/C# ternary conditional ?: operator in DWS:
"ColorToWebStr(FColor, if Transparent then 0 else 255);
Which is equal to C#'s:
ColorToWebStr(FColor, Transparent? 0 : 255);"

Wouldn't that be nice in Delphi? It's one of the things I really miss moving from C++ - that and RAII.

Comments