Embarcadero is working on a new version of Delphi (and RAD Studio) codenamed Ganymede and currently in Beta . In this blog post and others that are going to follow, we want to start introducing some of the exciting new features of this release. 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.
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.
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.