SmartPascal
Boolean
Type
Allows just True and False values System unit
  type Boolean = (False, True);
Description
The Boolean type provides an enumeration of the logical True and False values.
 
Unlike other languages, it is not a number - it will only allow these values. This makes the code much more reliable.
Notes
Using calculations to test for true or false is a C like practice, but is supported in Delphi. Use the following to hold such a logical number:

ByteBool
WordBool
LongBool

Related commands
And Boolean and or bitwise and of two arguments
If Starts a conditional expression to determine what to do next
Not Boolean Not or bitwise not of one arguments
Or Boolean or or bitwise or of two arguments
Xor Boolean Xor or bitwise Xor of two arguments
 
Example code : Boolean assignments and tests
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  // The System unit does not need to be defined
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  same : Boolean;
  small, large, i : Integer;

begin
  small := 23;
  large := 455555;

  // Test directly to see if these numbers are the same size
  if small = large
  then ShowMessage('small = large')
  else ShowMessage('small <> large');

  // Use a Boolean to hold and test this outcome
  same := (small = large);
  if same
  then ShowMessage('small = large')
  else ShowMessage('small <> large');

  // Assign a direct logical value to this Boolean
  same := True;
  if same
  then ShowMessage('same is True')
  else ShowMessage('same is False');
end;
 
end.
Hide full unit code
   small <> large
   small <> large
   same is True