Search⌘ K

is Expression

Explore how the is expression in D evaluates type conditions at compile time, enabling flexible static if conditionals and template constraints. Understand its syntax and applications to improve conditional compilation and type checking in your D programs.

The is expression is not related to the is operator that we saw in the null Value and the is Operator chapter, neither syntactically nor semantically:

a is b // is operator, which we have seen before 

is (/* ... */) // is expression

The is expression is evaluated at compile time. It produces an int value, either 0 ...