Name

In Keyword

Syntax

Ordinal expression in Set expression

Description

The in operator tests set membership. It returns True if the ordinal value is a member of the set, and it returns False otherwise.

Tips and Tricks

The base type for a set is limited to at most 256 members. The in operator tests only the least significant byte of the ordinal expression. The following example, therefore, always calls ShowMessage:

var
  X: set of 0..7;
begin
  X := [0];
  if 512 in X then
    ShowMessage('The in operator tests only the low byte of 512.');

Example

See the set keyword for an example.

See Also

Exclude Procedure, High Function, Include Procedure, Low Function, Set Keyword

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.