Among other improvements to the Delphi language and its compilers, the RAD Studio 13 release will introduce a conditional operator (or ternary operator) to the Object Pascal language, for the first time. This has been one of the most requested language enhancements by customers for quite some time and this feature is available in the current Ganymede beta for testing.
Table of Contents
Delphi now has a Ternary Operator using a new form of the If keyword
A ternary or conditional operator is an operator which behaves like an if statement, with a condition and two possible values. In many other programming languages, the ternary operator is indicated using the ?: syntax. In Delphi, we want to preserve as much as possible a familiar and Pascal-oriented syntax, so we decided to use the if symbol as an operator. In other words, if can now be used to indicate a statement or an operator, depending on the position in the source code.
See example here
RAD Studio 13 will bring in a number of other new features and modernizations to the Delphi language
While this won’t be the only change to the Delphi language in RAD Studio 13, it is one of the most prominent and requested changes to the language we are going to introduce. There are other new operators coming along, and some new and expanded compiler directives. Overall Delphi 13 (part of RAD Studio 13) is going to be a very important release for the evolution of the Delphi Object Pascal language. Stay tuned.
This blog post is based on a pre-release version of the RAD Studio software. No feature is committed until the product’s GA release.
Customers with an active subscription at the time of release will have access to version 13 when available.

