-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboolutils.pas
More file actions
33 lines (29 loc) · 823 Bytes
/
boolutils.pas
File metadata and controls
33 lines (29 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
unit boolUtils;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
//following functions checks if value is between specific range, so we can avoid
//complicated and potentially faulty if statements.
function Between(num,min,max:Integer):Boolean;
function Between(num,min,max:Double):Boolean;
function Between(num,min,max:Single):Boolean;
function Between(num,min,max:Real):Boolean;
implementation
function Between(num,min,max:Integer):Boolean;
begin
Result:=(num<max) and (num>min);
end;
function Between(num,min,max:Double):Boolean;
begin
Result:=(num<max) and (num>min);
end;
function Between(num,min,max:Single):Boolean;
begin
Result:=(num<max) and (num>min);
end;
function Between(num,min,max:Real):Boolean;
begin
Result:=(num<max) and (num>min);
end;
end.