Nullable types in Delphi for Win32
Nullable Types For Delphi For Win32


.Implemented integerNull type act as .NET Int32? type


With "Nullable For Delphi" it's possible write following code
procedure TForm1.Button3Click(Sender: TObject);
var
  i,a,b: IntegerNull;
  x: integer;
  e: Extended;
begin
  i := 3;
  i := nil;  //ActAs Pointer to value type
  i := 3;
  i := i + 1;
  i := i - 1;
  i := i * 3;
  x := i;
  e := i / 3;
  i := trunc(i / 3);
  inc(i);
  dec(i);
  i := i div 3;
  i := nil;
  i := a div b; //a and b is still not assigned, i become "nil"
  assert(i = nil); 
  i := '3'; //now "i" is 3, automatic conversion from string (no more StrToInt)
  assert(i = 3);
  i := '10' + i + '45'; //still... kill strtoint :-)
  showmessage(i); //show 58
end;

Comments? Suggestion? d.tetithehat@bittimethehat.it (if you want send email drop "thehat")

Powered by QwikiWiki v1.4 - www.qwikiwiki.com