Skip to content

Commit

Permalink
Extended nullable types sample
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Jul 29, 2024
1 parent d932857 commit 7e28bc9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions samples/nullable_types_showcase/NullableTypesShowcase.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ begin
{
lNullableInt.Value raises exception if "lNullableInt.IsNull = True"
}

lNullableInt := nil; // set to null
Assert(lNullableInt.IsNull);
Assert(not lNullableInt.HasValue);
lNullableInt := 123;
Assert(lNullableInt.HasValue);

lNullableInt.SetNull; // set to null
Assert(lNullableInt.IsNull);
Assert(not lNullableInt.HasValue);

lNullableInt.Clear; // set to null
Assert(lNullableInt.IsNull);
Assert(not lNullableInt.HasValue);
end;

begin
Expand Down

0 comments on commit 7e28bc9

Please sign in to comment.